제출 #223106

#제출 시각아이디문제언어결과실행 시간메모리
223106MKopchevToys (CEOI18_toy)C++14
100 / 100
3907 ms90496 KiB
#include<bits/stdc++.h> using namespace std; map<int, set<int> > seen; set<int> rec(int n) { if(seen.count(n))return seen[n]; set<int> ret={n-1};//use one type for(int i=2;i*i<=n;i++) if(n%i==0) { for(auto k:rec(n/i)) { ret.insert(k+i-1); } } seen[n]=ret; return ret; } int main() { int n; scanf("%i",&n); set<int> output=rec(n); printf("%i\n",output.size()); for(auto k:output) { printf("%i",k); if(k!=n-1)printf(" "); } printf("\n"); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

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