Notice
Recent Posts
Recent Comments
Link
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
Tags
more
Archives
Today
Total
관리 메뉴

코드와이

[BAEKJOON] 2563. 색종이 본문

acmicpc

[BAEKJOON] 2563. 색종이

코드와이 2021. 2. 10. 10:22

 

문제링크

www.acmicpc.net/problem/2563

 

2563번: 색종이

가로, 세로의 크기가 각각 100인 정사각형 모양의 흰색 도화지가 있다. 이 도화지 위에 가로, 세로의 크기가 각각 10인 정사각형 모양의 검은색 색종이를 색종이의 변과 도화지의 변이 평행하도록

www.acmicpc.net

 

package acmicpc;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

// 2563
public class 색종이 {
	public static void main(String[] args) throws NumberFormatException, IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		
		int T = Integer.parseInt(br.readLine());
		int[][] arr = new int[100][100];
		
		for(int tc = 1 ; tc <= T ; tc++) {
			st = new StringTokenizer(br.readLine(), " ");
			int x = Integer.parseInt(st.nextToken());
			int y = Integer.parseInt(st.nextToken());
			
			for(int i = 0 ; i < 10 ; i++) {
				for(int j = 0 ; j < 10 ; j++) {
					arr[i + x][j + y] = 1;
				}
			}
		}
		
		int ans = 0;
		for(int i = 0 ; i < 100 ; i++) {
			for (int j = 0 ; j < 100 ; j++) {
				if(arr[i][j] == 1) ans += 1;
			}
		}
		
		System.out.println(ans);
		
	}
}

'acmicpc' 카테고리의 다른 글

[BAEKJOON] 1072. 게임  (0) 2021.02.10
[BAEKJOON] 16926. 배열 돌리기1  (0) 2021.02.10
[BAEKJOON] 1158. 요세푸스 문제  (0) 2021.02.08
[BAEKJOON] 1244. 스위치 켜고 끄기  (0) 2021.02.06
[BAEKJOON] 2164. 카드2  (0) 2021.02.06