Submission #144185

# Submission time Handle Problem Language Result Execution time Memory
144185 2019-08-16T09:41:13 Z AldeaDanut Kotrljanje (COCI18_kotrljanje) C++14
126 / 140
2000 ms 2936 KB
#include <iostream>
using namespace std;

long long n,c,d,b,m,x,i,sum,sol;
int f[60000];

int main(){
    cin>>c>>d>>b>>m;

    x=3;
    while(true){
        n=c*x+d;
        sum=0;
        while(n){
            sum+=n%b;
            n/=b;
        }
        f[sum]++;

        if(f[sum]==m){
            sol=sum;
            break;
        }
        x+=b-1;
    }

    x=3;
    while(m){
        n=c*x+d;
        sum=0;
        while(n){
            sum+=n%b;
            n/=b;
        }

        if(sum==sol){
            cout<<x<<" ";
            m--;
        }
        x+=b-1;
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 99 ms 2936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 2424 KB Output is correct
2 Correct 66 ms 2452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 2424 KB Output is correct
2 Correct 70 ms 2552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 2680 KB Output is correct
2 Correct 84 ms 2576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 2700 KB Output is correct
2 Correct 225 ms 2308 KB Output is correct
3 Correct 99 ms 2656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 2828 KB Output is correct
2 Correct 85 ms 2808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 380 KB Output is correct
2 Correct 807 ms 1028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1820 ms 1896 KB Output is correct
2 Correct 1204 ms 2396 KB Output is correct
3 Execution timed out 2056 ms 2040 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 163 ms 2296 KB Output is correct
2 Correct 1002 ms 2424 KB Output is correct
3 Correct 94 ms 2808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 2808 KB Output is correct
2 Correct 89 ms 2296 KB Output is correct