Submission #142640

# Submission time Handle Problem Language Result Execution time Memory
142640 2019-08-10T07:42:51 Z Ruxandra985 Kotrljanje (COCI18_kotrljanje) C++14
140 / 140
1121 ms 28144 KB
#include <cstdio>
#include <vector>
using namespace std;
vector <long long> v[500000];
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,j,nr;
    long long n;
    scanf ("%d%d%d%d",&c,&d,&b,&m);
    for (n = 0; ; n += (b-1)){
        nr = scf(n * c + d , b);
        v[nr].push_back(n);
        if (v[nr].size() == m){
            for (j=0;j<v[nr].size();j++)
                printf ("%lld ",v[nr][j]);
            break;
        }
    }
    return 0;
}

Compilation message

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:23:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (v[nr].size() == m){
             ~~~~~~~~~~~~~^~~~
kotrljanje.cpp:24:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (j=0;j<v[nr].size();j++)
                      ~^~~~~~~~~~~~~
kotrljanje.cpp:19: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 time Memory Grader output
1 Correct 14 ms 12152 KB Output is correct
2 Correct 90 ms 18648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 17048 KB Output is correct
2 Correct 66 ms 17380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 16900 KB Output is correct
2 Correct 70 ms 17636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 17892 KB Output is correct
2 Correct 82 ms 17564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 17864 KB Output is correct
2 Correct 144 ms 18424 KB Output is correct
3 Correct 91 ms 17952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 18256 KB Output is correct
2 Correct 73 ms 17636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 12920 KB Output is correct
2 Correct 445 ms 18612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 993 ms 25996 KB Output is correct
2 Correct 683 ms 27664 KB Output is correct
3 Correct 1121 ms 28144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 132 ms 19336 KB Output is correct
2 Correct 552 ms 24136 KB Output is correct
3 Correct 85 ms 18436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 17536 KB Output is correct
2 Correct 71 ms 17000 KB Output is correct