标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9226 Accepted Submission(s): 1960
1 #include <cstdio> 2 3 int main() 4 { 5 int n,cn = 0; 6 while(scanf("%d",&n), n>0){ 7 if(cn != 0) 8 printf("\n"); 9 printf("Case %d.\n",++cn); 10 for(int i = 2; i*i <= n; ++i){ 11 int cnt = 0; 12 while(n%i == 0){ 13 ++cnt; 14 n /= i; 15 } 16 if(cnt != 0) 17 printf("%d %d ",i,cnt); 18 } 19 if(n>1) 20 printf("%d 1 ",n); 21 printf("\n"); 22 } 23 return 0; 24 }
标签:
原文地址:http://www.cnblogs.com/inmoonlight/p/5225649.html