Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by metvail ( 5 years ago )
#include<stdio.h>
int isFibonacci(long long n){
    long long f1=0,f2=1,f3=f1+f2;
    while(f3<n){
        f1=f2;
        f2=f3;
        f3=f1+f2;
    }
    if(f3==n) return 1;
    return 0;
}

int main(){
    int t;
    scanf("%d",&t);
    if(t>=1&&t<=100){
    while(t--){
        long long n;
        scanf("%lld",&n);
        if(isFibonacci(n)) printf("YES\n");
            else printf("NO\n");
    }
    }
}

 

Revise this Paste

Your Name: Code Language: