首页
IT
登录
6mi
u
盘
搜
搜 索
IT
2138 How many prime numbers
2138 How many prime numbers
xiaoxiao
2024-11-28
7
#include<iostream>
using
namespace
std
;
int
main() {
int
n,m,sum;
while
(
cin
>> n) { sum = n;
while
(n--&&
cin
>> m)
for
(
int
i =
2
; i <=
sqrt
(m);++i)
//这里用<=根号来节省时间,不然容易超时
if
(m%i ==
0
) { --sum;
break
;
//节省时间
}
cout
<< sum << endl; }
return
0
; }
转载请注明原文地址: https://ju.6miu.com/read-1294043.html
最新回复
(
0
)