Submission #311924

#TimeUsernameProblemLanguageResultExecution timeMemory
311924decoqwqKotrljanje (COCI18_kotrljanje)C++14
112 / 140
1302 ms3844 KiB
#pragma GCC optimize("-Ofast") #include <bits/stdc++.h> using namespace std; #define int long long int sum[1010000],c,d,b,m; const int inf=1e12; int mget(int x) { int res=0; while(x) { res+=x%b; x/=b; } return res; } signed main() { cin>>c>>d>>b>>m; int now=inf; for(int i=1;i<=1200000;i++,now+=(b-1)) { int qwq=c*now+d; int cnt=mget(qwq); sum[cnt]++; } int mans=-1,pos=0; for(int i=1;i<=1000000;i++) { if(sum[i]>mans) { mans=sum[i],pos=i; } } now=inf; int qaq=0; for(int i=1;i<=1200000;i++,now+=(b-1)) { int qwq=c*now+d; int cnt=mget(qwq); if(cnt==pos) { cout<<now<<" "; ++qaq; if(qaq==m) { 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...