Submission #144181

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

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

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){
            m--;
            cout<<x<<" ";
        }
        x+=b-1;
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 99 ms 2904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 2444 KB Output is correct
2 Correct 65 ms 2424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 2384 KB Output is correct
2 Correct 83 ms 2552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 2616 KB Output is correct
2 Correct 71 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 93 ms 2776 KB Output is correct
2 Correct 222 ms 2160 KB Output is correct
3 Correct 100 ms 2688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 96 ms 2828 KB Output is correct
2 Correct 96 ms 2900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 484 KB Output is correct
2 Correct 829 ms 1044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1825 ms 1880 KB Output is correct
2 Correct 1206 ms 2136 KB Output is correct
3 Execution timed out 2058 ms 2036 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 163 ms 2240 KB Output is correct
2 Correct 990 ms 2164 KB Output is correct
3 Correct 94 ms 2684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 2672 KB Output is correct
2 Correct 91 ms 2256 KB Output is correct