Cod sursa(job #3033255)
Utilizator | Data | 23 martie 2023 17:33:02 | |
---|---|---|---|
Problema | Nunta | Scor | 70 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("nunta.in");
ofstream g("nunta.out");
int n,i;
long long x,y,z;
int main()
{
f>>n;
if(n<=2)
{
g<<n;
return 0;
}
x=1;
y=2;
for(i=3;i<=n;i++)
{
z=x+y;
x=y;
y=z;
}
g<<z;
return 0;
}