Submission #711470

#TimeUsernameProblemLanguageResultExecution timeMemory
711470ToroTNToys (CEOI18_toy)C++14
100 / 100
1638 ms4400 KiB
#include<bits/stdc++.h> using namespace std; #define pb push_back //solution by PP..... int n; set<int> s; void solve(int num,int sum,int pre) { ///printf("%d %d %d\n",num,sum,pre); if(num==1) { s.insert(sum); return; } for(int i=1;i*i<=num;i++) { if(num%i==0) { if(i>=pre&&i!=1) { solve(num/i,sum+i-1,i); } if(num/i>=pre&&i*i!=num) { solve(i,sum+num/i-1,num/i); } } } } int main() { cin >> n; solve(n,0,0); printf("%d\n",s.size()); for(auto it=s.begin();it!=s.end();it++)printf("%d ",*it); }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:34:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   34 |     printf("%d\n",s.size());
      |             ~^    ~~~~~~~~
      |              |          |
      |              int        std::set<int>::size_type {aka long unsigned int}
      |             %ld
#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...