Submission #144202

#TimeUsernameProblemLanguageResultExecution timeMemory
144202AldeaDanutKotrljanje (COCI18_kotrljanje)C++14
126 / 140
1095 ms9880 KiB
#include <iostream> #include <vector> using namespace std; long long n,c,d,b,m,x,i,sum,sol; int f[30000]; vector <int> v[30000]; int main(){ cin>>c>>d>>b>>m; if(m<100000){ x=3; while(true){ n=c*x+d; sum=0; while(n){ sum+=n%b; n/=b; } f[sum]++; if(f[sum]==m){ sol=sum; break; } x+=b-1; } x=3; while(m){ n=c*x+d; sum=0; while(n){ sum+=n%b; n/=b; } if(sum==sol){ cout<<x<<" "; m--; } x+=b-1; } }else{ x=3; while(true){ n=c*x+d; sum=0; while(n){ sum+=n%b; n/=b; } v[sum].push_back(x); if(v[sum].size()==m){ sol=sum; break; } x+=b-1; } for(i=0;i<m;i++) cout<<v[sol][i]<<" "; } return 0; }

Compilation message (stderr)

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:56:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(v[sum].size()==m){
                ~~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...