제출 #1345947

#제출 시각아이디문제언어결과실행 시간메모리
1345947kawhietToys (CEOI18_toy)C++20
컴파일 에러
0 ms0 KiB
a#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 47
#endif

#define int long long

set<int> s;

void go(int n, int cnt, int sum, int prv) {
    if (n == 1) {
        s.insert(sum);
        return;
    }
    if (cnt == 0) {
        return;
    }
    for (int x = prv; ; x++) {
        int k = 1;
        for (int i = 0; i < cnt; i++) {
            k *= x;
            if (k > n) break;
        }
        if (k > n) break;
        if (n % x > 0) continue;
        go(n / x, cnt - 1, sum + x - 1, x);
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    go(n, 30, 0, 1);
    cout << s.size() << '\n';
    for (auto x : s) {
        cout << x << ' ';
    }
    cout << '\n';
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

toy.cpp:1:2: error: stray '#' in program
    1 | a#include <bits/stdc++.h>
      |  ^
toy.cpp:1:1: error: 'a' does not name a type
    1 | a#include <bits/stdc++.h>
      | ^
toy.cpp:12:1: error: 'set' does not name a type
   12 | set<int> s;
      | ^~~
toy.cpp: In function 'void go(long long int, long long int, long long int, long long int)':
toy.cpp:16:9: error: 's' was not declared in this scope
   16 |         s.insert(sum);
      |         ^
toy.cpp: In function 'int main()':
toy.cpp:35:5: error: 'ios' has not been declared
   35 |     ios::sync_with_stdio(false);
      |     ^~~
toy.cpp:36:5: error: 'cin' was not declared in this scope
   36 |     cin.tie(nullptr);
      |     ^~~
toy.cpp:40:5: error: 'cout' was not declared in this scope
   40 |     cout << s.size() << '\n';
      |     ^~~~
toy.cpp:40:13: error: 's' was not declared in this scope
   40 |     cout << s.size() << '\n';
      |             ^