forked from wotjd4305/Algorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswe3431.java
More file actions
39 lines (27 loc) · 715 Bytes
/
swe3431.java
File metadata and controls
39 lines (27 loc) · 715 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
37
38
import java.util.ArrayList;
import java.util.Scanner;
public class swe3431 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
int answer;
//테스트케이스
for(int t=0; t<T; t++) {
answer = 0;
int L = sc.nextInt();
int U = sc.nextInt();
int X = sc.nextInt();
answer = solution(L,U,X);
System.out.println("#" + (t+1) + " " + answer);
}
}
public static int solution(int L, int U, int X)
{
if(X < L)
return L-X;
if(U < X)
return -1;
else
return 0;
}
}