Submission #883687

#TimeUsernameProblemLanguageResultExecution timeMemory
883687tsumondaiToys (CEOI18_toy)C++14
100 / 100
656 ms5020 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define mp make_pair #define foru(i, l, r) for(int i = l; i <= r; i++) #define ford(i, r, l) for(int i = r; i >= l; i--) #define __TIME (1.0 * clock() / CLOCKS_PER_SEC) typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; const int N = 1e6 + 5; const int oo = 1e9, mod = 1e9 + 7; int n, m, k; string s; vector<int> arr; set<int> ans; void res(int n, int last, int sum) { ans.insert(sum + n - 1); for(int i = last; i <= n / i; i++) if (n % i == 0) res(n / i, i, sum + i - 1); } void process() { int n; cin >> n; res(n, 2, 0); cout << ans.size() << '\n'; for (int x : ans) cout << x << ' '; cout << '\n'; } signed main() { cin.tie(0)->sync_with_stdio(false); //freopen(".inp", "r", stdin); //freopen(".out", "w", stdout); process(); cerr << "Time elapsed: " << __TIME << " s.\n"; return 0; } // dont stop
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...