슈콩

[SWEA] 진기의 최고급 붕어빵 본문

Algorithms/SWEA

[SWEA] 진기의 최고급 붕어빵

shukong 2025. 11. 6. 21:10

 

 

 

[문제]

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5LsaaqDzYDFAXc

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

 

 

[소스 코드]

import java.util.*;
import java.io.*;
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());
			int k = Integer.parseInt(st.nextToken());
			int[] people = new int[n];
			st = new StringTokenizer(br.readLine());
			for(int i=0;i<n;i++) {
				people[i] = Integer.parseInt(st.nextToken());
			}
			Arrays.sort(people);
			boolean possible = true;
			for(int i=0;i<n;i++) {
				if(people[i]<m) possible = false;
				if(people[i]/m*k-i < 1) possible = false;
			}
			if(!possible) System.out.println("#"+tc+" Impossible");
			else System.out.println("#"+tc+" Possible");
		}
	}
}

'Algorithms > SWEA' 카테고리의 다른 글

[SWEA] 7일차 - 암호생성기  (0) 2025.11.09
[SWEA] 재미있는 오셀로 게임  (3) 2025.11.07
[SWEA] 3일차 - 회문 2  (0) 2025.11.06
[SWEA] 2일차 - Sum  (0) 2025.11.06
[SWEA] 최장 경로  (0) 2025.11.05