Submission #144058

#TimeUsernameProblemLanguageResultExecution timeMemory
144058AldeaDanutKotrljanje (COCI18_kotrljanje)C++14
126 / 140
2040 ms2956 KiB
#include <iostream> using namespace std; long long n,c,d,b,m,x,i,sum,sol,f[30000]; int main(){ cin>>c>>d>>b>>m; x=3; for(i=1;;i++){ 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; for(i=1;;i++){ n=c*x+d; sum=0; while(n){ sum+=n%b; n/=b; } if(sum==sol){ m--; cout<<x<<" "; } x+=b-1; if(m==0) break; } return 0; }
#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...