목차
문제 정보
https://codeforces.com/problemset/problem/703/A
Problem - 703A - Codeforces
codeforces.com
난이도 : A
유형 : implementation
시간 : O(n)
문제 풀이
승리가 많은 사람을 출력
코드
import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.StringTokenizer
fun solution() = with(BufferedReader(InputStreamReader(System.`in`))) {
var mCnt = 0
var cCnt = 0
var n = readLine().toInt()
for (i in 0 until n) {
var st = StringTokenizer(readLine())
var m = st.nextToken().toInt()
var c = st.nextToken().toInt()
if (m > c) {
mCnt++
} else if (m < c) {
cCnt++
}
}
if (mCnt == cCnt) {
println("Friendship is magic!^^")
} else if (mCnt > cCnt) {
println("Mishka")
} else {
println("Chris")
}
}
fun main() {
solution()
}
'Algorithm, Problem Solving > codeforces' 카테고리의 다른 글
[codeforces][Kotlin] 1367B - Even Array (0) | 2023.03.30 |
---|---|
[codeforces][Kotlin] 1475A - Odd Divisor (0) | 2023.03.29 |
[codeforces][Kotlin] 313A - Ilya and Bank Account (0) | 2023.03.27 |
[codeforces][Kotlin] 466A - Cheap Travel (0) | 2023.03.25 |
[codeforces][Kotlin] 189A - Cut Ribbon (0) | 2023.03.24 |
댓글