Submission #145058

#TimeUsernameProblemLanguageResultExecution timeMemory
145058Linca_RobertKotrljanje (COCI18_kotrljanje)C++14
140 / 140
1106 ms18648 KiB
#include<bits/stdc++.h> using namespace std; const int DIM = 1e5; int C, D, B, M; long long curr, aux; vector<long long> arr[DIM]; inline int suma( long long x ){ int s = 0; while( x != 0 ){ s += x % B; x /= B; } return s; } int main(){ cin >> C >> D >> B >> M; aux = 1LL * C * (B - 1); curr = aux + D; for( int i = 1; ; i++ ){ int s = suma( curr ); arr[s].push_back( i ); if( arr[s].size() == M ){ for( int j = 0; j < arr[s].size(); j++ ) cout << 1LL * arr[s][j] * (B - 1) << " "; break; } curr += aux; } return 0; }

Compilation message (stderr)

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:25:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if( arr[s].size() == M ){
             ~~~~~~~~~~~~~~^~~~
kotrljanje.cpp:26:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for( int j = 0; j < arr[s].size(); j++ )
                             ~~^~~~~~~~~~~~~~~
#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...