language: C++ (gcc-4.3.4)
date: 101 days 19 hours ago
link:
visibility: public
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
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
long long int n,k,pom,s,wyn;
int main()
{
  long long int t[101];
  t[0]=0;
  t[1]=1;
  for(int i=2;i<90;i++)
  {
    t[i]=t[i-2]+t[i-1];
  }
  scanf("%lld", &n);
  for(int j=0;j<n;j++)
  {
    scanf("%lld", &k);
    wyn=0;
    s=k;
    for(int h=0;h<100001;h++)
    {
      pom=t[89];
      for(int i=0;i<90;i++)
      {
        if(t[i]<s) pom=min(pom,s-t[i]);
        else pom=min(pom, t[i]-s);
        //cout<<pom<<" "<<s<<" "<<t[i]<<endl;
      }
      wyn++;
      if(pom==0)break;
      s=pom;
    }
   printf("%lld\n", wyn);
  }
  return 0;
}