- 「CEOI2018」玩具
为什么会WA?
- @ 2025-10-9 21:36:13
`#include<bits/stdc++.h> #define int long long using namespace std; const int N = 2e7 + 7; int a[N]; int n, ans; inline void dfs(int n, int x, int cnt){ if(x <= n) a[++ans] = cnt + n - 1; for(int i = x; i * i <= n; i++) if(n % i == 0) dfs(n / i, i, cnt + i - 1); } signed main(){ cin >> n; dfs(n, 2, 0); sort(a + 1, a + ans + 1); ans = unique(a + 1, a + ans + 1) - a - 1; cout << ans << "\n"; for(int i = 1; i <= ans; i++) cout << a[i] << " "; return 0; }``````` 为什么会WA 81 在[CEOI 2018]toy 提交是对的。
0 comments
No comments so far...
Information
- ID
- 16378
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 10
- Tags
- # Submissions
- 3
- Accepted
- 0
- Uploaded By