| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1345948 | kawhiet | Toys (CEOI18_toy) | C++20 | 5092 ms | 1444 KiB |
#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;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
