답안 #142501

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
142501 2019-08-09T10:34:49 Z KCSC Kotrljanje (COCI18_kotrljanje) C++14
0 / 140
6 ms 2812 KB
#include <bits/stdc++.h>
using namespace std;

const int DIM = 50005;

int frq[DIM];
vector<int> lst[DIM];

int _b;
int convert(long long x) {
    int s = 0;
    for (; x; x /= _b)
        s += x % _b;
    return s;
}

int main(void) {
    freopen("kotrljanje.in", "r", stdin);
    freopen("kotrljanje.out", "w", stdout);
    int c, d, b, m;
    scanf("%d %d %d %d", &c, &d, &b, &m);
    long long aux = 1LL * c * (b - 1), aux1 = aux + d; _b = b;
    for (int i = 1; i; i++, aux1 += aux) {
        int v = convert(aux1);
        ++frq[v];
        lst[v].push_back(i);
        if (frq[v] == m) {
            for (int x : lst[v])
                printf("%lld ", 1LL * x * (b - 1));
            break;
        }
    }
    return 0;
}

Compilation message

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:18:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("kotrljanje.in", "r", stdin);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kotrljanje.cpp:19:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("kotrljanje.out", "w", stdout);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kotrljanje.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d %d", &c, &d, &b, &m);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 2808 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 2808 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 2808 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 2808 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 2808 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 2780 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 2812 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 2808 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 2808 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 2700 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -