# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
267058 | bigg | Triangles (CEOI18_tri) | C++14 | 1 ms | 256 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |