Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
直接枚举16ms...代码数据太水了...可以用long long 存下 #include <iostream> #include <cstdio> using namespace std; const int maxn=100+10; const int end=20; int n; long long now; void plusOne() { int tmp=10; while(true) { if(now%tmp>=tmp/10) { now-=tmp/10; } else break; tmp*=10; } now+=tmp/10; } int main() { // freopen("in.txt","r",stdin); while(~scanf("%d",&n)) { if(!n) break; now=1; while(now%n) plusOne(); printf("%lld\n",now); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator