标签:des style blog color java os io strong
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 658 Accepted Submission(s): 365
1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <vector> 5 #include <algorithm> 6 using namespace std; 7 8 char s[100]; 9 char str[200]; 10 11 int solve(){ 12 int a[100]; 13 char s1[100]; 14 int i, j, n=strlen(s); 15 for(i=2;i<=n;i++){ 16 memset(s1,‘\0‘,sizeof(s1)); 17 memset(a,0,sizeof(a)); 18 for(j=n-1;j>=0;j--) a[j]=s[n-j-1]-‘0‘; 19 for(j=0;j<n;j++) a[j]*=i; 20 for(i=0;i<=n+2;i++){ 21 a[i+1]=a[i+1]+a[i]/10; 22 a[i]%=10; 23 } 24 int k=n+2; 25 while(!a[k]) k--; 26 for(j=n-1;j>=0;j--) s1[j]=a[n-j-1]+‘0‘; 27 if(!strstr(str,s1)) return 0; 28 } 29 return 1; 30 } 31 32 main() 33 { 34 while(scanf("%s",s)!=EOF){ 35 strcpy(str,s); 36 strcat(str,s); 37 int ans=solve(); 38 if(ans) printf("%s is cyclic\n",s); 39 else printf("%s is not cyclic\n",s); 40 } 41 }
HDU 1313 高精度*单精度,布布扣,bubuko.com
标签:des style blog color java os io strong
原文地址:http://www.cnblogs.com/qq1012662902/p/3913759.html