-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFibonaci.java
More file actions
28 lines (27 loc) · 815 Bytes
/
Fibonaci.java
File metadata and controls
28 lines (27 loc) · 815 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
import java.util.*;
public class Fibonaci {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t-- > 0) {
long a[] = new long[100];
a[0] = 0;
a[1] = 1;
long n = in.nextLong();
if (n == 0 || n == 1)
System.out.println("YES");
else {
for (int i = 2; i < 93; i++) {
a[i] = a[i - 1] + a[i - 2];
if (a[i] == n) {
System.out.println("YES");
break;
} else if (a[i] > n) {
System.out.println("NO");
break;
}
}
}
}
}
}