알고리즘/백준
백준 5523 경기결과
고구마와 감자
2022. 12. 9. 21:46
https://www.acmicpc.net/problem/5523
5523번: 경기 결과
A와 B가 게임을 한다. 게임은 N번의 라운드로 이루어져 있다. 각 라운드에서는, 더 많은 점수를 얻은 사람이 그 라운드의 승자가 된다. 즉, A의 점수가 B의 점수보다 크면 i번째 라운드는 A의 승리
www.acmicpc.net
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
int aWin = 0;
int bWin = 0;
StringTokenizer st;
for (int i = 0; i < N; i++) {
st = new StringTokenizer(br.readLine());
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
if (a > b) aWin++;
else if (b > a) bWin++;
}
System.out.println(aWin + " " + bWin);
}
}