-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKiemTraSoFibonacci.java
More file actions
36 lines (36 loc) · 933 Bytes
/
KiemTraSoFibonacci.java
File metadata and controls
36 lines (36 loc) · 933 Bytes
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
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package baitap;
import java.util.*;
/**
*
* @author khanh
*/
public class KiemTraSoFibonacci {
public static void main(String[] args) {
long a[]=new long[93];
a[0]=0;
a[1]=1;
for(int i=2;i<93;i++){
a[i]=a[i-1]+a[i-2];
}
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t>0){
t--;
long n=sc.nextLong();
for(int i=0;i<93;i++){
if(a[i]==n){
System.out.println("YES");
break;
}
else if(a[i]>n){
System.out.println("NO");
break;
}
}
}
}
}