nyoj-212 & whoj-1313
来源:互联网 发布:windows xp sp3 纯净版 编辑:程序博客网 时间:2024/04/29 14:15
#include<iostream>#include<string.h>using namespace std;int a[1111],v[1111];int main(){int t;cin>>t;while(t--){int n,flag=0;memset(v,0,sizeof(v));cin>>n;if(n>=1000){flag=1;n%=1000;}int i=0,k=1,count;while(1){i++;k*=n;if(k>=1000 || flag){k%=1000;if(!v[k])v[k]=i;else {count=v[k];break;}flag=1;}}cout<<count+i<<endl;}return 0;}
#include<iostream>#include<string.h>using namespace std;int a[1111],v[1111];int main(){ int n; while(cin>>n && n) { int flag=0; memset(v,0,sizeof(v)); if(n>=1000) { flag=1; n%=1000; } int i=0,k=1,count; while(1) { i++; k*=n; if(k>=1000 || flag) { k%=1000; if(!v[k]) v[k]=i; else { count=v[k]; break; } flag=1; } } cout<<count+i<<endl; } return 0;}
- nyoj-212 & whoj-1313
- whoj-1314
- WHOJ-1603 Minimum Sum
- WHOJ 1603 - Minimum Sum【思维】
- WHOJ 1609 - Han Move【细心】
- WHOJ 1606 - Funny Sheep【水】
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- nyoj-62
- hdu-2063
- nyoj-239
- nyoj-55
- nyoj-636
- nyoj-212 & whoj-1313
- whoj-1314
- (转载)用匈牙利算法求二分图的最大匹配
- (转)ACM大牛
- hdu-1568
- zencart文件替换和zencart升级
- hdu-1023
- poj-1002
- poj-1007