Skip to content

Commit 4df74e1

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents b22604b + 6aede65 commit 4df74e1

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Time: 265 ms
2+
// Memory: 1000 KB
3+
// brute-force.
4+
// T:O(t), S:O(1)
5+
//
6+
import java.util.Scanner;
7+
8+
public class Codeforces_2060A_Fibonacciness {
9+
public static void main(String[] args) {
10+
Scanner sc = new Scanner(System.in);
11+
int t = sc.nextInt();
12+
for (int i = 0; i < t; i++) {
13+
int a1 = sc.nextInt(), a2 = sc.nextInt(), a4 = sc.nextInt(), a5 = sc.nextInt(), ret = 1;
14+
int[] arr = new int[]{a1 + a2, a4 - a2, a5 - a4};
15+
for (int j : arr) {
16+
int tmp = 0;
17+
if (a1 + a2 == j) {
18+
tmp++;
19+
}
20+
if (a2 + j == a4) {
21+
tmp++;
22+
}
23+
if (j + a4 == a5) {
24+
tmp++;
25+
}
26+
ret = Math.max(ret, tmp);
27+
if (ret == 3) {
28+
break;
29+
}
30+
}
31+
System.out.println(ret);
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)