标签:code scanf color turn log amp prime for bsp
1 #include<stdio.h> 2 #include<math.h> 3 bool prime(int n) 4 { 5 if(n==1) 6 return false; 7 int i,t=(int)sqrt(1.0*n); 8 for(i=2; i<=t; ++i) 9 if(!(n%i)) 10 return false; 11 return true; 12 } 13 int main() 14 { 15 int n,ans; 16 while(~scanf("%d",&n)) 17 { 18 ans=0; 19 while(n--) 20 { 21 int m; 22 scanf("%d",&m); 23 if(prime(m)) 24 ++ans; 25 } 26 printf("%d\n",ans); 27 } 28 }
标签:code scanf color turn log amp prime for bsp
原文地址:http://www.cnblogs.com/qq188380780/p/6388065.html