Submission #748920

#TimeUsernameProblemLanguageResultExecution timeMemory
748920bgnbvnbvToys (CEOI18_toy)C++14
100 / 100
745 ms9232 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll, ll> #define fi first #define se second #define pb push_back const int N = 1e5+5; const long long mod = 1e9+7; const long double pi = acos(-1); const int base = 300; ll k, t; ll a[N], ans, m, n, b[N], tong, d[N], c[N], lab[N], cnt, h[N], P[N][20]; vector<pll> val[N]; vector<ll> adj[N], res; string s; set<ll> st; void cal(ll n, ll lst, ll sum) { st.insert(sum+n-1); for(int i = lst; i <= n / i; i ++) { if(n % i == 0) { cal(n/i, i, sum+i-1); } } } void sol() { cin >> n; cal(n, 2, 0); cout << st.size() << '\n'; for(ll x : st)cout << x <<" "; } int main() { sol(); }
#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...