공부기록/백준

[백준] 2563번 색종이

메델 2024. 1. 31. 05:33
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner kb = new Scanner(System.in);
		
		int n = kb.nextInt();
		int[][] checked = new int[100][100];
		
		for(int i=0; i<n; i++) {
			int a = kb.nextInt();
			int b = kb.nextInt();
			
			for(int j=a; j<a+10; j++) {
				for(int k=b; k<b+10; k++) {
					checked[j][k] = 1;
				}
			}
			
		}
		
		int answer = 0;
		
		for(int i=0; i<100; i++) {
			for(int j=0; j<100; j++) {
				if(checked[i][j]== 1) answer++;
			}
		}
		
		System.out.println(answer);
		
	}
}