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
- Java
- 알고리즘
- 투포인터
- dfs
- 이분탐색
- priorityqueue
- 운동기록
- 코테
- MySQL
- 문제해결
- 러닝일지
- 백준
- 문자열
- DP
- BOJ
- 건강
- 자바
- db
- greedy
- binary search
- BFS
- 시뮬레이션
- SQL
- 프로그래머스
- 코딩테스트
- oracle
- COS PRO
- SWEA
Archives
- Today
- Total
슈콩
[BOJ] 백준 7795 먹을 것인가 먹힐 것인가 본문
[문제]
https://www.acmicpc.net/problem/7795
[소스 코드]
import java.io.*;
import java.util.*;
public class Main {
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=0;tc<T;tc++) {
st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
int[] a = new int[n];
int[] b = new int[m];
st = new StringTokenizer(br.readLine());
for(int i=0;i<n;i++) {
a[i] = Integer.parseInt(st.nextToken());
}
st = new StringTokenizer(br.readLine());
for(int i=0;i<m;i++) {
b[i] = Integer.parseInt(st.nextToken());
}
Arrays.sort(a);
Arrays.sort(b);
int cnt = 0;
compare:
for(int i=0;i<n;i++) {
for(int j=0;j<m;j++) {
if(a[i]>b[j]) {
cnt++;
}
else continue compare;
}
}
System.out.println(cnt);
}
}
}'Algorithms > Baekjoon' 카테고리의 다른 글
| [BOJ] 백준 10884 쉬운 계단 수 (2) | 2025.08.21 |
|---|---|
| [BOJ] 백준 1003 피보나치 함수 (0) | 2025.08.21 |
| [BOJ] 백준 5648 역원소 정렬 (0) | 2025.08.20 |
| [BOJ] 백준 2910 빈도 정렬 (0) | 2025.08.20 |
| [BOJ] 백준 11656 접미사 배열 (0) | 2025.08.20 |