제출 #131136

#제출 시각아이디문제언어결과실행 시간메모리
131136VardanyanToys (CEOI18_toy)C++14
79 / 100
5024 ms47900 KiB
#include <bits/stdc++.h> using namespace std; set<int> s; map<pair<int,int>,int> mp; void rec(int n,int sm){ if(mp[{n,sm}]) return; mp[{n,sm}] = 1; if(n == 1){ s.insert(sm); return; } for(int i = 1;i*i<=n;i++){ if(n%i) continue; if(i>1) rec(n/i,sm+i-1); int x = n/i; rec(n/x,sm+x-1); } } int main(){ ios_base::sync_with_stdio(false); int n; cin>>n; rec(n,0); cout<<s.size()<<endl; set<int>::iterator it = s.begin(); for(;it!=s.end();it++){ cout<<*(it)<<endl; } return 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...