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

[문제]
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14jJh6ACYCFAYD
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
[소스 코드]
import java.io.*;
import java.util.*;
public class Solution {
static HashMap<String,Integer> hm = new HashMap<>();
static String[] nums = {"ZRO", "ONE", "TWO", "THR", "FOR", "FIV", "SIX", "SVN", "EGT", "NIN"};
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
StringBuilder sb;
for(int i=0;i<10;i++) {
hm.put(nums[i], i);
}
int T = Integer.parseInt(br.readLine());
for(int tc=1;tc<=T;tc++) {
st = new StringTokenizer(br.readLine());
sb = new StringBuilder();
st.nextToken();
int n = Integer.parseInt(st.nextToken());
int[] cnt = new int[10];
st = new StringTokenizer(br.readLine());
for(int i=0;i<n;i++) {
String num = st.nextToken();
cnt[hm.get(num)]++;
}
for(int i=0;i<10;i++) {
int v = cnt[i];
for(int j=0;j<v;j++) {
sb.append(nums[i]+" ");
}
}
System.out.println("#"+tc);
System.out.println(sb);
}
}
}'Algorithms > SWEA' 카테고리의 다른 글
| [SWEA] 격자판 칠하기 (0) | 2025.11.14 |
|---|---|
| [SWEA] 식료품 가게 (0) | 2025.11.14 |
| [SWEA] 삼성시의 버스 노선 (0) | 2025.11.14 |
| [SWEA] 태혁이의 사랑은 타이밍 (0) | 2025.11.14 |
| [SWEA] 다트 게임 (0) | 2025.11.14 |