HDU 1405格式题
http://acm.hdu.edu.cn/showproblem.php?pid=1405
纯属没有说清楚的格式题。。。orz
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include<stdio.h> 2 #include<string.h> 3 #include<math.h> 4 int prime(int n) 5 { 6 int i; 7 int y=(int)sqrt(n); 8 for(i=2;i<=y;i++) 9 if(n%i==0)return 0; 10 return 1; 11 } 12 int main() 13 { 14 int x,a[66000],i,n,ca=1; 15 while(scanf("%d",&n),n>1) 16 { 17 x=n; 18 if(ca>1)printf("\n"); 19 printf("Case %d.\n",ca++); 20 if(prime(n)){ 21 printf("%d 1 \n",n); 22 continue; 23 } 24 memset(a,0,sizeof(a)); 25 i=2; 26 while(n>1) 27 { 28 if(prime(i)&&n%i==0) 29 { 30 a[i]++; 31 n/=i; 32 } 33 else i++; 34 } 35 for(i=2;i<=x/2;i++) 36 { 37 if(a[i]) 38 printf("%d %d ",i,a[i]); 39 } 40 printf("\n"); 41 } 42 return 0; 43 }