#CS41006. 阅读程序10-数论6
阅读程序10-数论6
阅读程序
注意:切勿用电脑直接运行代码得出答案,请用大脑+笔+纸运行代码答题,否则是在浪费你的时间。
第10节:数论
第6题【NOIP】2014
#include <iostream>
using namespace std;
int main(){
04 int a, b, i, tot, c1, c2;
scanf( "%d%d", &a, &b );
06 tot = 0;
for ( i = a; i <= b; i++ ){
08 c1 = i / 10;
c2 = i % 10;
if ( (c1 + c2) % 3 == 0 )tot++;
}
printf( "%d", tot );
return(0);
}
●判断题
(1)将第6行去掉会导致运行错误。
{{ select(6-1) }}
- 正确
- 错误
(2)将第4行去掉会导致编译错误
{{ select(6-2) }}
- 正确
- 错误
(3)若a,b都是99以内的整数,将第8行替换为“c1=i/10”没有影响。
{{ select(6-3) }}
- 正确
- 错误
4)若a,b都是99以内的整数,则答案为区间[a,b]中3的倍数的数量。
{{ select(6-4) }}
- 正确
- 错误
●选择题
(5)输入1100,则输出()
{{ select(6-5) }}
- 31
- 32
- 33
- 24
(6)输人110000,则输出()
{{ select(6-6) }}
- 3333
- 3400
- 258
- 1950