Submission #141227

# Submission time Handle Problem Language Result Execution time Memory
141227 2019-08-07T07:12:16 Z mariusnicoli Kotrljanje (COCI18_kotrljanje) C++14
126 / 140
2000 ms 2920 KB
#include <iostream>
#include <vector>
#include <map>

using namespace std;
int mp[30000];
long long c, d, b, m, p, i, n, suma, sol;

int main () {

    cin>>c>>d>>b>>m;
    p = 1;
    while (p <= d)
        p*=b;
    for (i=1;;i++) {
        n = 1LL*c*i*(b-1)+d;
        suma = 0;
        while (n) {
            suma += n%b;
            n/=b;
        }

        mp[suma] ++;

        if (mp[suma] == m) {
            sol = suma;
            break;
        }
        ///}
    }

    for (i=1;m;i++) {
        n = 1LL*c*i*(b-1)+d;
        suma = 0;
        while (n) {
            suma += n%b;
            n/=b;
        }
        if (suma == sol) {
            cout<<i*(b-1)<<" ";
            m--;
        }
        ///}
    }


}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 101 ms 2920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 2416 KB Output is correct
2 Correct 68 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 2396 KB Output is correct
2 Correct 73 ms 2552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 2552 KB Output is correct
2 Correct 82 ms 2708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 2680 KB Output is correct
2 Correct 204 ms 2188 KB Output is correct
3 Correct 106 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 93 ms 2784 KB Output is correct
2 Correct 77 ms 2808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 416 KB Output is correct
2 Correct 805 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1824 ms 1768 KB Output is correct
2 Correct 1214 ms 2148 KB Output is correct
3 Execution timed out 2009 ms 1916 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 176 ms 2216 KB Output is correct
2 Correct 967 ms 2188 KB Output is correct
3 Correct 95 ms 2728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 85 ms 2784 KB Output is correct
2 Correct 78 ms 2180 KB Output is correct