fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int n, a=1, b=1, c, ile=0;
  7. cin >> n;
  8.  
  9. if (n==1 || n==2)
  10. cout << ile << endl;
  11. else
  12. {
  13. for (int i=3; i<=n; i++)
  14. {
  15. c=a+b;
  16. if (c%2==0) ile++;
  17. a=b;
  18. b=c;
  19. }
  20. cout << ile << endl;
  21. }
  22.  
  23.  
  24.  
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 5244KB
stdin
5
stdout
1