Submission #145057

# Submission time Handle Problem Language Result Execution time Memory
145057 2019-08-18T15:39:45 Z Linca_Robert Kotrljanje (COCI18_kotrljanje) C++14
28 / 140
1106 ms 18428 KB
#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 << arr[s][j] << " ";
            break;
        }
        curr += aux;
    }
    return 0;
}

Compilation message

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 time Memory Grader output
1 Incorrect 5 ms 2808 KB numbers not having same digit sum in base B
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 6816 KB numbers not having same digit sum in base B
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 6884 KB numbers not having same digit sum in base B
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 7704 KB numbers not having same digit sum in base B
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 7652 KB numbers not having same digit sum in base B
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 7896 KB numbers not having same digit sum in base B
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 41 ms 3576 KB Output is correct
2 Correct 444 ms 9216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 973 ms 16760 KB Output is correct
2 Correct 669 ms 18372 KB Output is correct
3 Correct 1106 ms 18428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 9660 KB numbers not having same digit sum in base B
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 7428 KB numbers not having same digit sum in base B
2 Halted 0 ms 0 KB -