标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 5113 Accepted Submission(s):
2851
1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 int main() 5 { 6 int n,sum,i; 7 while(cin>>n&&n) 8 { 9 sum=1; 10 i=n; 11 while(i--) 12 sum=(sum*n)%9; 13 if(sum==0) 14 cout<<9<<endl; 15 else 16 cout<<sum<<endl; 17 } 18 return 0; 19 }
标签:
原文地址:http://www.cnblogs.com/a1225234/p/4658185.html