Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define int long long
- using namespace std;
- ifstream fin("text.in");
- ofstream fout("text.out");
- int32_t main() {
- int N, a = 0, b = 1;
- fin >> N;
- if(N == 0) {
- fout << 0;
- return 0;
- }
- if(N == 1) {
- fout << 1;
- return 0;
- }
- for(int i = 2; i <= N; ++i) {
- int c = a + b;
- a = b;
- b = c;
- }
- fout << b;
- }
Advertisement
Add Comment
Please, Sign In to add comment