-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathSolution.java
More file actions
25 lines (22 loc) · 811 Bytes
/
Copy pathSolution.java
File metadata and controls
25 lines (22 loc) · 811 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
import java.io.*;
import java.util.*;
class Solution {
public static void main(String[] argh) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int i = 0; i < t; i++) {
try {
long x = sc.nextLong();
System.out.println(x + " can be fitted in:");
if (-128 <= x && x <= 127) System.out.println("* byte");
if (-32_768 <= x && x <= 32_767) System.out.println("* short");
if (
-2_147_483_648 <= x && x <= 2_147_483_647
) System.out.println("* int");
System.out.println("* long");
} catch (Exception e) {
System.out.println(sc.next() + " can't be fitted anywhere.");
}
}
}
}