본문 바로가기

정올문제소스코드

1438 : 색종이(초)

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub
        
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
     
        int i, j, k;
         
        int ColorPaperCnt = 0;
        int x,y;
        int paper[][] = new int[110][110];
        int cnt = 0;
         
        Scanner sc = new Scanner(System.in);
        ColorPaperCnt = sc.nextInt();
         
        for (i = 0; i < ColorPaperCnt; i++) {
            x = sc.nextInt();           
            y = sc.nextInt();
             
            for (j = y; j < y + 10; j++) {
                for (k = x; k < x + 10; k++) {
                    paper[j][k] = 1;
                     
                }
            }
        }
         
        for (i = 0; i < 101; i++) {
            for (j = 0; j < 101; j++) {
                if (paper[i][j] == 1) cnt++;
            }
        }
             
        bw.write(String.format("%d", cnt));
        bw.flush();
    }
 
}

http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=712&sca=2060

'정올문제소스코드' 카테고리의 다른 글

1311 : 카드게임  (0) 2021.10.29
1671 : 색종이(중)  (0) 2021.10.29
3699 : 변장  (0) 2021.10.08
1516 : 단어 세기  (0) 2021.10.08
1880 : 암호풀기(Message Decoding)  (0) 2021.08.11