반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
Tags
- codeup 1020 자바
- docker 완전 삭제
- 가운데 글자 가져오기 자바
- 최단 경로 알고리즘
- 핸즈온 머신러닝
- 코드업 1020 java
- 가운데 글자 가져오기 파이썬
- m1 docker install
- 프로그래머스 나누어 떨어지는 숫자 배열 자바
- 가운데 글자 가져오기 java
- 최소 스패닝 트리 자바
- m1 docker
- docker remove
- 프로그래머스 나누어 떨어지는 숫자 배열 파이썬
- 빅분기실기
- 청년 Ai Big Data 아카데미
- 프로그래머스 가운데 글자 가져오기 python
- 트리의 지름 java
- 나누어 떨어지는 숫자 배열 python
- 빅데이터분석기사
- docker 삭제
- 청년 AI Big Data 아카데미 13기
- 프로그래머스 가운데 글자 가져오기 자바
- 나누어 떨어지는 숫자 배열 java
- 트리의 지름 자바
- 최소 스패닝 트리
- 코드업 1020 자바
- 프로그래머스 가운데 글자 가져오기 파이썬
- 가운데 글자 가져오기 python
- codeup 1020 java
Archives
- Today
- Total
NineTwo meet you
[CodeUp/자바] 1098 : [기초-2차원배열] 설탕과자 뽑기 본문
반응형
코드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.BufferedWriter; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.OutputStreamWriter; | |
import java.util.StringTokenizer; | |
public class CodeUp1098 { | |
public static void main(String[] args) throws IOException { | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); | |
String str[] = br.readLine().split(" "); | |
int h = Integer.parseInt(str[0]); | |
int w = Integer.parseInt(str[1]); | |
int n = Integer.parseInt(br.readLine()); | |
int board[][] = new int[h][w]; | |
for(int i = 0; i < n; i++) { | |
StringTokenizer st = new StringTokenizer(br.readLine()); | |
int l = Integer.parseInt(st.nextToken()); | |
int d = Integer.parseInt(st.nextToken()); | |
int x = Integer.parseInt(st.nextToken())-1; | |
int y = Integer.parseInt(st.nextToken())-1; | |
if(d == 0) { //가로 | |
for(int j = y; j < y+l; j++) { | |
board[x][j] = 1; | |
} | |
}else { // 세로 | |
for(int j = x; j < x+l; j++) { | |
board[j][y] = 1; | |
} | |
} | |
} | |
for(int i = 0; i < h; i++) { | |
for(int j = 0; j < w; j++) { | |
bw.write(board[i][j]+" "); | |
} | |
bw.write("\n"); | |
} | |
bw.flush(); | |
bw.close(); | |
br.close(); | |
} | |
} |
반응형
'프로그래밍 문제 > CodeUp' 카테고리의 다른 글
[CodeUp/자바] 1099 : [기초-2차원배열] 성실한 개미 (0) | 2020.12.21 |
---|---|
[CodeUp/자바] 1097 : [기초-2차원배열] 바둑알 십자 뒤집기(설명) (0) | 2020.12.21 |
[CodeUp/자바] 1095 : [기초-1차원배열] 이상한 출석 번호 부르기3(설명) (0) | 2020.12.21 |
[CodeUp/자바] 1094 : [기초-1차원배열] 이상한 출석 번호 부르기2(설명) (0) | 2020.12.21 |
[CodeUp/자바] 1092 : [기초-종합] 함께 문제 푸는 날(설명) (0) | 2020.12.21 |
Comments