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


[문제]
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AXBbOcTav0QDFAVg
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));
StringTokenizer st;
int T = Integer.parseInt(br.readLine());
for(int tc=1;tc<=T;tc++) {
int[] nums = new int[10];
Arrays.fill(nums, 1);
int n = Integer.parseInt(br.readLine());
for(int i=0;i<n;i++) {
st = new StringTokenizer(br.readLine());
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
int c = Integer.parseInt(st.nextToken());
int d = Integer.parseInt(st.nextToken());
String answer = st.nextToken();
if(answer.equals("YES")) {
nums[a] *= 2;
nums[b] *= 2;
nums[c] *= 2;
nums[d] *= 2;
}
else {
nums[a] *= 0;
nums[b] *= 0;
nums[c] *= 0;
nums[d] *= 0;
}
}
int max = 0;
int idx = 0;
for(int i=0;i<=9;i++) {
if(max<nums[i]) {
max = nums[i];
idx = i;
}
}
System.out.println("#"+tc+" "+idx);
}
}
}'Algorithms > SWEA' 카테고리의 다른 글
| [SWEA] 성공적인 공연 기획 (0) | 2025.11.18 |
|---|---|
| [SWEA] 극장 좌석 (0) | 2025.11.18 |
| [SWEA] 유효기간 (0) | 2025.11.18 |
| [SWEA] 홀수일까 짝수일까 (0) | 2025.11.17 |
| [SWEA] 계산기 (0) | 2025.11.17 |