Submission #1090893

#TimeUsernameProblemLanguageResultExecution timeMemory
1090893vjudge1Toys (CEOI18_toy)C++14
100 / 100
1379 ms4688 KiB
// [CEOI2018] toys #include <bits/stdc++.h> using namespace std; vector<int> F; set<int> A; void dfs(int li, const int s, const int n) { if (n == 1) { A.insert(s); return; } for (size_t i = li; i < F.size() and F[i] <= n; ++i) if (n % F[i] == 0) dfs(i, s + F[i] - 1, n / F[i]); } int main() { ios::sync_with_stdio(false), cin.tie(0); int n; cin >> n; for (int i = 2; i * i <= n; i++) { if (n % i) continue; F.push_back(i); // 计算所有约数 if (n % i != i) F.push_back(n / i); } F.push_back(n), sort(begin(F), end(F)); dfs(0, 0, n); cout << A.size() << "\n"; for (int a : A) cout << a << " "; return 0; } // ❓❓ 0
#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...