ZJNU 2204 - of math homework dzj

I guess the number of columns can be directly descending Minato ......

Padova launched several columns each, descending cycle

Experiencing less than or equal to x entry to lose this one

After the completion of the entire cycle is determined whether x is 0 to

 1 #include<stdio.h>
 2 typedef long long ll;
 3 ll a1,a2,a3,d[50];
 4 void cal(){
 5     ll a4=a2+a1;
 6     a1=a2;
 7     a2=a3;
 8     a3=a4;
 9 }
10 int sc(ll x){
11     int i=49;
12     while(i&&x){
13         if(d[i]<=x)
14             x-=d[i];
15         i--;
16     }
17     if(x)
18         return 0;
19     return 1;
20 }
21 int main(){
22     int i,T;
23     ll x;
24     a1=a2=a3=1;
25     d[0]=0;
26     d[1]=a3;
27     for(i=2;i<50;i++){
28         cal();
29         cal();
30         cal();
31         d[i]=a3;
32     }
33     scanf("%d",&T);
34     while(T--){
35         scanf("%lld",&x);
36         printf((sc(x)?"Yes\n":"No\n"));
37     }
38     
39     return 0;
40 }

 

Guess you like

Origin www.cnblogs.com/stelayuri/p/12236614.html