백준 #24294번 ГРАДИНА

jhj·2024년 2월 14일

백준 JAVA

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

0개의 댓글