알고리즘/SwExpert recipe

[SWEA] 준환이의 운동관리 [D3]

컵라면만두세트 2021. 2. 24. 01:06
package D3;

import java.util.Scanner;

public class 준환이의운동관리 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		for(int tc = 1; tc<=T; tc++) {
			int L = sc.nextInt();// 최소 운동 분
			int U = sc.nextInt(); //  최대 운동 분
			int X = sc.nextInt(); // 준환이가 운동한 부분
			int ans = 0;
			if(L<=X && U>=X) {
				ans = 0; // 운동을 더해야함
			}else if(L>X) {
				ans = L-X;
			}else if(U<X) {
				ans = -1;
				
			}
			System.out.println("#" + tc + " " + ans);
		} 
	}

}

'알고리즘 > SwExpert recipe' 카테고리의 다른 글

[SWEA] 거듭제곱 [D3]  (0) 2021.02.24
[SWEA] 장애물 경주 난이도 [D3]  (0) 2021.02.24
[SWEA] 백만 장자 프로젝트 [D2]  (0) 2021.02.23
[SWEA] 간단한 압축 풀기 [D2]  (0) 2021.02.22
SWEA 간단한 369게임 [D2]  (0) 2021.02.18