Submission #145054

#TimeUsernameProblemLanguageResultExecution timeMemory
145054MihneaKotrljanje (COCI18_kotrljanje)C++14
126 / 140
2051 ms3064 KiB
#include<iostream> using namespace std; long long c,d,b,m,nr,s; long long f[30000]; int main(){ cin>>c>>d>>b>>m; long long x=3; long long suma; while(1==1){ nr=c*x+d; suma=0; while(nr){ suma+=nr%b; nr/=b; } f[suma]++; if(f[suma]==m){ s=suma; break; } x+=b-1; } x=3; while(1==1){ nr=c*x+d; suma=0; while(nr){ suma+=nr%b; nr/=b; } if(suma==s){ 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...