Created
February 8, 2022 13:10
-
-
Save sedin2/cbb83a652e0f9f3076275d6ee278f943 to your computer and use it in GitHub Desktop.
Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package SWEA; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.io.StringReader; | |
import java.util.StringTokenizer; | |
public class Main { | |
static String input = "3\n" + | |
"300 400 240\n" + | |
"300 400 350\n" + | |
"300 400 480"; | |
public static void main(String[] args) throws Exception { | |
BufferedReader br = new BufferedReader(new StringReader(input)); | |
// BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
StringTokenizer st; | |
int T = Integer.parseInt(br.readLine()); | |
for (int tc = 1; tc <= T; tc++) { | |
st = new StringTokenizer(br.readLine()); | |
int L = Integer.parseInt(st.nextToken()); | |
int U = Integer.parseInt(st.nextToken()); | |
int X = Integer.parseInt(st.nextToken()); | |
if (X < L) { | |
System.out.print("#" + tc + " " + (L - X)); | |
} | |
if (L < X && X < U) { | |
System.out.print("#" + tc + " " + 0); | |
} | |
if (X > U) { | |
System.out.print("#" + tc + " " + -1); | |
} | |
System.out.println(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SWEA - D3 - 3431 - 준환이의 운동관리