problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
acwing::acwing719类 参考

AcWing 719. 连续奇数的和 2 更多...

#include <acwing.h>

静态 Public 成员函数

static int main (istream &cin, ostream &cout)
 

详细描述

AcWing 719. 连续奇数的和 2

在文件 acwing.h762 行定义.

成员函数说明

◆ main()

int acwing::acwing719::main ( istream &  cin,
ostream &  cout 
)
static

在文件 acwing.cpp2178 行定义.

2178 {
2179 unsigned short n;
2180 cin >> n;
2181 for(unsigned short i = 0; i < n; i++) {
2182 int count = 0;
2183 int x;
2184 int y;
2185 cin >> x >> y;
2186 if(x > y) {
2187 const int temp = y;
2188 y = x;
2189 x = temp;
2190 }
2191 if(x % 2 == 0) {
2192 x++;
2193 } else {
2194 x += 2;
2195 }
2196 for(int j = x; j < y; j += 2) {
2197 count += j;
2198 }
2199 cout << count << endl;
2200 }
2201 return 0;
2202 }

被这些函数引用 acwing::TEST().


该类的文档由以下文件生成: