Submission #383423

#TimeUsernameProblemLanguageResultExecution timeMemory
383423rumen_mToys (CEOI18_toy)C++17
0 / 100
1 ms364 KiB
# include <bits/stdc++.h> using namespace std; vector <int> nums; void solve(int n, int sum, int l) { if(n==1){nums.push_back(sum);return;} for(int i=1;i*i<=n;i++) { if(n%i==0) { if(i>=l) { solve(n/i,sum+i-1,i); } if(n/i>=l) { solve(i,sum+n/i-1,n/i); } } } } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin>>n; solve(n,0,2); sort(nums.begin(),nums.end()); cout<<nums.size()<<endl; for(int i = 0;i<nums.size();i++) cout<<nums[i]<<" "; cout<<endl; }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:31:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int i = 0;i<nums.size();i++)
      |                   ~^~~~~~~~~~~~
#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...