1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <cmath>
using namespace std;

int pseudo_fib(int cut, int c){
   unsigned long long f, f2, m;
   int krok;
   int i;
   if (c==0) return 0;
   if (c==1) return 1;
   f2 = 0;
   f  = 1;
   krok =1;

   i=2;
   
   
   while(i<= 100000000){
       m  = f + f2;
       f2 = f;
       f  = m;
	
	   if (f>cut) f=f%cut;
	 
	   //cout << i << endl;
	   if (f==c){
			cout << i << endl;
			break;
			}
		else {if (i==100000000) cout << "NIE";}
	i=i+krok;
	}
   return f;
}
   
int main()
{
    unsigned long long cut, temp;
	unsigned long long c;
    cin >> c;
	temp = (int)(log10(c)+1);
	cut = pow(10, temp);

	pseudo_fib(cut, c);
	
    return 0;
}