Submission #267055

#TimeUsernameProblemLanguageResultExecution timeMemory
267055pedroslreyToys (CEOI18_toy)C++17
100 / 100
908 ms4728 KiB
#include <bits/stdc++.h> using namespace std; set<int> ans; void calc(int n, int stop, int sum) { ans.insert(sum + n - 1); for (int i = stop; i <= n/i; ++i) if (n % i == 0) calc(n/i, i, sum + i - 1); } int main() { int n; scanf("%d", &n); calc(n, 2, 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...