Submission #267089

#TimeUsernameProblemLanguageResultExecution timeMemory
267089Kenzo_1114Toys (CEOI18_toy)C++17
100 / 100
631 ms4732 KiB
#include<bits/stdc++.h> using namespace std; int n, sum; set<int> ans; set<int> :: iterator it; void BKT(int num, int last) { ans.insert(num + sum - 1); if(num == 1) return; for(long long int i = last; i * i <= num; i++) { if(num % i == 0) { sum += i - 1; BKT(num / i, i); sum -= i - 1; } } } int main () { scanf("%d", &n); BKT(n, 2); printf("%d\n", (int) ans.size()); for(it = ans.begin(); it != ans.end(); it++) printf("%d ", (*it)); printf("\n"); }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   26 |  scanf("%d", &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...