Submission #239065

# Submission time Handle Problem Language Result Execution time Memory
239065 2020-06-14T09:40:48 Z VEGAnn Kotrljanje (COCI18_kotrljanje) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")
#define i2 array<int,2>
#define PB push_back
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
using namespace std;
typedef long long ll;
const int N = 20100;
const ll OO = 1e18;
const int oo = 2e9;
const int md = int(1e9) + 7;
int cnt[N];
ll C, D, B, M;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

#ifdef _LOCAL
    freopen("in.txt","r",stdin);
#endif // _LOCAL

    cin >> C >> D >> B >> M;

    for (ll i = 1; ; i++){
        ll cur = i * C + D;

        ll sum = 0;

        while (cur > 0){
            sum += cur % B;
            cur /= B;
        }

        cnt[sum]++;

        if (cnt[sum] == M){
            for (ll j = 1; j < i; j++) {
                cur = j * C + D;

                nw = 0;

                while (cur > 0){
                    nw += cur % B;
                    cur /= B;
                }

                if (sum == nw)
                    cout << j << " ";
            }

            cout << i;
            return 0;
        }
    }

    return 0;
}

Compilation message

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:45:17: error: 'nw' was not declared in this scope
                 nw = 0;
                 ^~