#include<stdio.h> #include<math.h> int solve(int n){ int ans=0; if(n==1)return 1; int root=sqrt(n); if(root*root==n) { ans+=1; for(int i=2;i<root;++i) { if(n%i==0) ans+=2; } } else for(int i=2;i<=root;++i) { if(n%i==0) ans+=2; } ans+=2; return ans; } int main(int argc, char *argv[]) { int N; int t; while(~scanf("%d",&N)) { for(int i=0;i<N;++i) { scanf("%d",&t); printf("%d\n",solve(t)); } } return 0; } /************************************************************** Problem: 1087 User: kirchhoff Language: C Result: Accepted Time:110 ms Memory:928 kb ****************************************************************/
原文地址:http://blog.csdn.net/wdkirchhoff/article/details/42241215