Submission #128202

#TimeUsernameProblemLanguageResultExecution timeMemory
128202TadijaSebezToys (CEOI18_toy)C++11
100 / 100
509 ms16976 KiB
#include <bits/stdc++.h> using namespace std; vector<int> ans; int n; void Solve(int sum, int ost, int last) { ans.push_back(sum+ost-1); for(int i=last;i*i<=ost;i++) { if(ost%i==0) { Solve(sum+i-1,ost/i,i); } } } int main() { scanf("%i",&n); Solve(0,n,2); sort(ans.begin(),ans.end()); ans.resize(unique(ans.begin(),ans.end())-ans.begin()); printf("%i\n",ans.size()); for(int x:ans) printf("%i ",x); printf("\n"); return 0; }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:22:26: warning: format '%i' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
  printf("%i\n",ans.size());
                ~~~~~~~~~~^
toy.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i",&n);
  ~~~~~^~~~~~~~~
#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...