Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define P 301104
  3. using namespace std;
  4.  
  5. ifstream fin("bilean.in");
  6. ofstream fout("bilean.out");
  7.  
  8. int main()
  9. {
  10. int a, b, c, i, n;
  11. fin>>n;
  12. a=2;
  13. b=3;
  14. if(n==1)
  15. {
  16. fout<<a<< "\n";
  17. return 0;
  18. }
  19. if(n==2)
  20. {
  21. fout<< b<< "\n";
  22. return 0;
  23. }
  24. for(i=3; i<=n; i++)
  25. {
  26. c=(a+b)%P;
  27. a=b;
  28. b=c;
  29. }
  30. fout<<b<< "\n";
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement