백준 #30017번 치즈버거 만들기

jhj·2024년 3월 2일

백준 JAVA

목록 보기
432/583
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int total = 0;
		
		if(a <= b || b == a - 1) {
			total += a + (a - 1);
		}else {
			total += b + (b + 1);
		}
		System.out.println(total);
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글