Cod sursa(job #1461123)
Utilizator | Data | 14 iulie 2015 19:41:06 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
using namespace std;
int a;
int n;
void compute(int s, int j) {
a++;
if (s + j <= n) {
compute(s + j, j);
compute(s, s + j);
}
}
int main() {
ifstream("fractii.in");
ofstream("fractii.out");
fi >> n;
compute(1, 1);
fo << a;
fi.close();
fo.close();
return 0;
}