fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a, s, x, y, z;
  6. x = 1;
  7. y = 0;
  8. z = 2;
  9. cin >> a;
  10. while (a != s){
  11. x = x + y;
  12. y = x - y;
  13. s = x + y;
  14. z = z + 1;
  15. }
  16. cout << z << endl;
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5288KB
stdin
8
stdout
6