Submission #128193

#TimeUsernameProblemLanguageResultExecution timeMemory
128193TadijaSebezToys (CEOI18_toy)C++11
0 / 100
2 ms380 KiB
#include <bits/stdc++.h> using namespace std; vector<int> ans; int n; int po(int x, int y) { if(y==2) return x*x; if(y==3) return x*x*x; if(y==4) return x*x*x*x; } void Solve(int sz, int sum, int ost, int last) { if(sz==1) { sum+=ost-1; ans.push_back(sum); return; } for(int i=1;po(i,sz)<=ost;i++) { if(ost%i==0) { Solve(sz-1,sum+i-1,ost/i,i); } } } int main() { scanf("%i",&n); Solve(4,0,n,1); 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:33: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: In function 'int po(int, int)':
toy.cpp:10:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
toy.cpp: In function 'int main()':
toy.cpp:29: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...