답안 #142638

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
142638 2019-08-10T07:30:32 Z Ruxandra985 Kotrljanje (COCI18_kotrljanje) C++14
126 / 140
1093 ms 10488 KB
#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

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);
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1656 KB Output is correct
2 Runtime error 49 ms 6624 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 5348 KB Output is correct
2 Correct 52 ms 4840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 65 ms 5420 KB Output is correct
2 Correct 66 ms 5468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 5220 KB Output is correct
2 Correct 57 ms 5228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 66 ms 5476 KB Output is correct
2 Correct 127 ms 5756 KB Output is correct
3 Correct 74 ms 6036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 5660 KB Output is correct
2 Correct 72 ms 5884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 1912 KB Output is correct
2 Correct 432 ms 5304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 965 ms 9480 KB Output is correct
2 Correct 661 ms 10392 KB Output is correct
3 Correct 1093 ms 10488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 110 ms 6452 KB Output is correct
2 Correct 544 ms 8924 KB Output is correct
3 Correct 71 ms 5612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 63 ms 5780 KB Output is correct
2 Correct 70 ms 5092 KB Output is correct