이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define sst string
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define freeopen freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define mod 1000000007
#define pb push_back
#define mk make_pair
#define foor(x,vec) for(auto x:vec ){cout<<x<<" ";}
#define fi first
#define se second
#define MAXN 300069
#define ll int
#define lld long double
#define cha ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ffl fflush(stdout)
#define pii pair<ll,ll>
typedef pair<ll, ll> pll;
ll n;
vector <ll> vec;
set <ll> ans;
map<ll,ll> vis;
void rek(ll node,ll sum,ll sta){
ans.insert(node+sum-1);
for(ll i=sta;i*i<=node;i++){
if(node%i==0)
rek(node/i,sum+i-1,i);
}
}
int main(){
scanf("%d", &n);
if(n==1){
cout<<1<<endl;
cout<<0<<endl;
return 0;
}
rek(n,0,2);
cout<<ans.size()<<endl;
for(auto x : ans){
cout<<x<<" ";
}
cout<<endl;
}
컴파일 시 표준 에러 (stderr) 메시지
toy.cpp: In function 'int main()':
toy.cpp:32:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
32 | 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... |