Submission #142638

#TimeUsernameProblemLanguageResultExecution timeMemory
142638Ruxandra985Kotrljanje (COCI18_kotrljanje)C++14
126 / 140
1093 ms10488 KiB
#include <cstdio> #include <vector> using namespace std; vector <int> v[50000]; int scf (long long x,int b){ int sol = 0; while (x){ sol = sol + (x%b); x/=b; } return sol; } int main() { // freopen ("a.in" , "r" , stdin); // freopen ("a.out" , "w" , stdout); int c,d,b,m,n,j,nr; scanf ("%d%d%d%d",&c,&d,&b,&m); for (n = 1; ; n += (b-1)){ nr = scf((long long)c * n + d , b); v[nr].push_back(n); if (v[nr].size() == m){ for (j=0;j<v[nr].size();j++) printf ("%d ",v[nr][j]); break; } } return 0; }

Compilation message (stderr)

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:22:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (v[nr].size() == m){
             ~~~~~~~~~~~~~^~~~
kotrljanje.cpp:23:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (j=0;j<v[nr].size();j++)
                      ~^~~~~~~~~~~~~
kotrljanje.cpp:18:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d%d%d%d",&c,&d,&b,&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...