Submission #424657

#TimeUsernameProblemLanguageResultExecution timeMemory
424657HazemToys (CEOI18_toy)C++14
39 / 100
12 ms332 KiB
#include <bits/stdc++.h> using namespace std; #define LL long long #define F first #define S second #define pii pair<int,int> #define piii pair<pair<int,int>,int> const int N = 2e5+10; const int M = 1e3+10; const LL INF = 1e12; const LL LINF = 2e18; const LL MOD = 1e9+7; const double PI = 3.141592653589793; vector<int>vec; set<int>st; int n; void bt(int pos,int sum,int p){ if(pos==vec.size()){ if(p==n)st.insert(sum); return ; } if(n%(p*vec[pos])==0) bt(pos,sum+vec[pos]-1,p*vec[pos]); bt(pos+1,sum,p); } int main(){ //freopen("out.txt","w",stdout); scanf("%d",&n); for(int i=2;i<=n;i++) if(n%i==0)vec.push_back(i); bt(0,0,1); printf("%d\n",st.size()); for(auto x:st) printf("%d ",x); }

Compilation message (stderr)

toy.cpp: In function 'void bt(int, int, int)':
toy.cpp:23:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     if(pos==vec.size()){
      |        ~~~^~~~~~~~~~~~
toy.cpp: In function 'int main()':
toy.cpp:43:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   43 |     printf("%d\n",st.size());
      |             ~^    ~~~~~~~~~
      |              |           |
      |              int         std::set<int>::size_type {aka long unsigned int}
      |             %ld
toy.cpp:37:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |     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...