Submission #444721

#TimeUsernameProblemLanguageResultExecution timeMemory
444721definitelynotmeeToys (CEOI18_toy)C++98
100 / 100
629 ms4292 KiB
//not my code    
#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:17:11: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |      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...