Submission #494336

#TimeUsernameProblemLanguageResultExecution timeMemory
494336fcmalkcinToys (CEOI18_toy)C++17
100 / 100
1753 ms4388 KiB
#include <bits/stdc++.h> using namespace std; typedef long long LL; set<int> num; void solve(int n, int x, int l){ if(n == 1){ num.insert(x); } for(int a = 1; a * a <= n; a++){ if(n % a == 0){ if(a >= l) solve(n/a, x+a-1, a); if(n/a >= l) solve(a, x+n/a-1, n/a); } } } int main(){ int n; cin >> n; solve(n, 0, 2); cout << num.size() << '\n'; for(int x : num){ cout << x << " "; } cout << '\n'; }
#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...