반응형
import java.util.Scanner;
class Solution
{
public static void main(String args[]) throws Exception
{
Scanner sc = new Scanner(System.in);
int password;
password =sc.nextInt();
int K;
K = sc.nextInt();
if(password > K){
System.out.print(password - K + 1);
return;
}
if (password == K){
System.out.print(0);
return;
}
System.out.print(password + (1000 - K));
}
}
반응형
'알고리즘' 카테고리의 다른 글
[SWEA][D1] 1936. 1대1 가위바위보 Java (0) | 2025.05.27 |
---|---|
[SWEA][D1] 1933. 간단한 N 의 약수 JAVA (0) | 2025.05.27 |
오픈채팅방 (42888 / 프로그래머스 / JavaScript) (1) | 2021.12.21 |
모음사전 ( 84512 /프로그래머스 / JavaScript) (0) | 2021.12.12 |
124나라의 숫자 ( 12899 / 프로그래머스 / JavaScript) (1) | 2021.12.03 |