Submission #1031043

#TimeUsernameProblemLanguageResultExecution timeMemory
1031043matthewhutamaToys (CEOI18_toy)C++14
100 / 100
392 ms4504 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; set <ll> ans; ll n; void solve(ll idx, ll cur, ll start){ ans.insert(cur + idx - 1); for (int i = start; i <= sqrt(idx) ; i++){ if (idx % i == 0) solve(idx / i, cur + i - 1, i); } } int main(){ cin >> n; solve(n, 0, 2); cout << ans.size()<<endl; for (auto u: ans){ cout << u <<" "; } }
#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...