Cod sursa(job #2056202)
Utilizator | Data | 4 noiembrie 2017 09:54:58 | |
---|---|---|---|
Problema | Nunta | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream f("nunta.in");
ofstream g("nunta.out");
int N,a,b,c,i;
a=1;
b=2;
f>>N;
if(N=1)g<<1;
else if(N=2)g<<2;
else{
for(i=2;i<N;i++){
c=a+b;
a=b;
b=c;
}
}
g<<c;
}