이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optmize("O3")
typedef int ll;
typedef long double ld;
#define vii vector<pair<int, int>>
#define vi vector<int>
#define vl vector<long long>
#define vll vector<pair<long long, long long>>
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i = a;i<=b;i++)
#define f first
#define s second
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define start int tt;cin>>tt;rep(testcase, 1, tt)
#define print(k) cout<<"Case #"<<testcase<<": "<<k<<"\n";
#define endl "\n"
set<ll> ans;
void solve(ll n, ll k, ll sum) {
ans.insert(sum + n -1);
for(int i = k;i<= n/k;i++) {
if(n%i == 0) {
solve(n/i, i, sum + i -1);
}
}
}
int main () {
//FIO;
/*#ifndef ONLINE_JUDGE
freopen("stdin", "r", stdin);
freopen("stdout", "w", stdout);
freopen("stderr", "w", stderr);
#endif*/
int n;
scanf("%d", &n);
solve(n, 2, 0);
printf("%d\n", int(ans.size()));
for(int i:ans) {
printf("%d ", i);
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
toy.cpp:3: warning: ignoring '#pragma GCC optmize' [-Wunknown-pragmas]
3 | #pragma GCC optmize("O3")
|
toy.cpp: In function 'int main()':
toy.cpp:36:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
36 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |