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 |
Re:c++ T g++ a了In Reply To:c++ T g++ a了 Posted by:sll_ at 2014-07-20 17:19:45 > #include <iostream> > #include <algorithm> > #include <cstring> > #include <cstdio> > #include <cstdlib> > #include<math.h> > #include<queue> > #define INF 0x7f7f7f7f > using namespace std; > int main() > { > int i,j,k,l,n; > long long sum; > while(scanf("%d",&n)&&n) > { > queue<long long>q; > q.push(1); > while(!q.empty()) > { > sum=q.front(); > q.pop(); > if(sum%n==0) > { > printf("%lld\n",sum); > break; > } > q.push(sum*10); > q.push(sum*10+1); > } > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator