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


[문제]
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWh4FhG6Ei4DFAXp
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++) {
st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
String[] lottos = new String[n];
int[] price = new int[n];
for(int i=0;i<n;i++) {
st = new StringTokenizer(br.readLine());
lottos[i] = st.nextToken();
price[i] = Integer.parseInt(st.nextToken());
}
int result = 0;
for(int i=0;i<m;i++) {
String cmp = br.readLine();
for(int j=0;j<n;j++) {
String lotto = lottos[j];
boolean check = true;
for(int t=0;t<8;t++) {
if(lotto.charAt(t)!='*' && cmp.charAt(t)!=lotto.charAt(t))
check = false;
}
if(check) result += price[j];
}
}
System.out.println("#"+tc+" "+result);
}
}
}'Algorithms > SWEA' 카테고리의 다른 글
| [SWEA] 방울 마술 (0) | 2025.11.23 |
|---|---|
| [SWEA] 육십갑자 (0) | 2025.11.22 |
| [SWEA] 문자열 교집합 (0) | 2025.11.22 |
| [SWEA] 두 수의 덧셈 (0) | 2025.11.21 |
| [SWEA] 다솔이의 월급 상자 (0) | 2025.11.21 |