Description
Input
Output
Sample Input
2 25608 24027
Sample Output
768016016
#include <iostream> #include <cstring> #include <cmath> using namespace std; int a[32778]; int main() { int cn,n,i,j,sum=0; double k; cin >> cn ; while(cn--) { sum=0; memset(a,0,sizeof(a)); cin >> n; for(i=2;i<=n;++i) { if(n%i==0) { for(j=i;j<n;j+=i) { a[j]=1; } } } for(i=2;i<n;++i) { if(a[i]==0) { sum++; } } cout << sum+1 << endl; } return 0; }
原文地址:http://blog.csdn.net/zsc2014030403015/article/details/43484601