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 |
| 31 |
Tags
- math
- priorityqueue
- 투포인터
- SWEA
- 백준
- dfs
- db
- 이분탐색
- MySQL
- Java
- greedy
- 문자열
- COS PRO
- 러닝일지
- SQL
- 코테
- 알고리즘
- binary search
- 코딩테스트
- 시뮬레이션
- 문제해결
- 운동기록
- 건강
- DP
- 문제풀이
- BFS
- 자바
- BOJ
- 프로그래머스
- oracle
Archives
- Today
- Total
슈콩
[SWEA] 체스판 위의 룩 배치 본문

[문제]
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AYOBfxwaAXsDFATW
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
[소스 코드]
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
for(int tc=1;tc<=T;tc++) {
char[][] map = new char[8][8];
boolean[] row = new boolean[8];
boolean[] col = new boolean[8];
boolean result = true;
for(int i=0;i<8;i++) {
map[i] = br.readLine().toCharArray();
}
int cnt = 0;
for(int i=0;i<8;i++) {
for(int j=0;j<8;j++) {
if(map[i][j]=='O') {
if(!row[i] && !col[j]) {
cnt++;
}
else result = false;
row[i] = col[j] = true;
}
}
}
if(cnt!=8) result = false;
if(!result) System.out.println("#"+tc+" no");
else System.out.println("#"+tc+" yes");
}
}
}'Algorithms > SWEA' 카테고리의 다른 글
| [SWEA] 민정이와 광직이의 알파벳 공부 (0) | 2025.11.15 |
|---|---|
| [SWEA] 이진수 표현 (0) | 2025.11.15 |
| [SWEA] 무한 문자열 (0) | 2025.11.15 |
| [SWEA] 팰린드롬 문제 (0) | 2025.11.15 |
| [SWEA] 화섭이의 정수 나열 (0) | 2025.11.15 |