题库 信息学奥赛题库 题目列表 阅读程序写结果:#include <iostream> using na...
填空题

阅读程序写结果:

#include <iostream> using namespace std; const int SIZE = 100; int main() { int p[SIZE]; int n, tot, i, cn; tot = 0; cin >> n; for ( i = 1; i <= n; i++ ) p[i] = 1; for ( i = 2; i <= n; i++ ) { if ( p[i] == 1 ) tot++; cn = i * 2; while ( cn <= n ) { p[cn] = 0; cn += i; } } cout << tot << endl; return(0); }

输入:30

输出:___

题目信息
2014年 初赛
-
正确率
0
评论
48
点击