Submission #267052

#TimeUsernameProblemLanguageResultExecution timeMemory
267052pedroslreyToys (CEOI18_toy)C++17
59 / 100
5055 ms964 KiB
#include <bits/stdc++.h> using namespace std; set<int> ans; void calc(int n, int sum) { ans.insert(sum + n - 1); for (int i = 2; i <= n/i; ++i) if (n % i == 0) calc(n/i, sum + i - 1); } int main() { int n; scanf("%d", &n); calc(n, 0); printf("%d\n", (int)ans.size()); for (int x: ans) printf("%d ", x); printf("\n"); }

Compilation message (stderr)

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