ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#148290 | #1110. 奇数和 | sunfmin | 100 | 0ms | 508kb | C++ | 522b | 2022-05-27 12:07:44 | 2022-05-27 12:07:45 |
answer
#include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
int total = 0;
for (int i = a; i <= b; i=i+2) {
int n = i + 1;
if (i % 2 == 1) {
n = i;
} else {
if (i == b) {
break;
}
}
//printf("%d\n", n);
total = total + n;
}
printf("%d\n", total);
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 20
Accepted
time: 0ms
memory: 504kb
input:
48 517
output:
66505
result:
ok single line: '66505'
Test #2:
score: 20
Accepted
time: 0ms
memory: 508kb
input:
44 844
output:
177600
result:
ok single line: '177600'
Test #3:
score: 20
Accepted
time: 0ms
memory: 508kb
input:
45 546
output:
74045
result:
ok single line: '74045'
Test #4:
score: 20
Accepted
time: 0ms
memory: 508kb
input:
18 1093
output:
299128
result:
ok single line: '299128'
Test #5:
score: 20
Accepted
time: 0ms
memory: 508kb
input:
38 142
output:
4680
result:
ok single line: '4680'