Submission #267059

#TimeUsernameProblemLanguageResultExecution timeMemory
267059biggToys (CEOI18_toy)C++14
100 / 100
711 ms4476 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; set<ll> resp; void backtrack(ll soma, ll qualfat, ll n ){ resp.insert(soma + n - 1); for(int fat = qualfat; fat * fat <= n; fat++){ if(!(n%fat)){ backtrack(soma + fat -1, fat, n/fat); } } } ll n; int main(){ scanf("%lld", &n); backtrack(0, 2, n); printf("%lu\n", resp.size()); for(set<ll> :: iterator it = resp.begin(); it != resp.end(); it++){ printf("%lld ", *it); } 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("%lld", &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...