백준 #31009번 진주로 가자! (Easy)

jhj·2024년 5월 20일

백준 JAVA

목록 보기
482/583
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		String[] a = new String[n];
		int[] b = new int[n];
		int index = 0;
		
		for(int i = 0; i < n; i++) {
			a[i] = sc.next();
			b[i] = sc.nextInt();
			if(a[i].equals("jinju")) {
				index = i;
			}
		}
		
		int count = 0;
		for(int i = 0; i < n; i++) {
			if(b[i] > b[index]) {
				count++;
			}
		}
		System.out.println(b[index]);
		System.out.println(count);
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글