結果
問題 | No.227 簡単ポーカー |
ユーザー |
|
提出日時 | 2024-11-17 15:27:57 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 344 ms / 5,000 ms |
コード長 | 773 bytes |
コンパイル時間 | 14,203 ms |
コンパイル使用メモリ | 440,948 KB |
実行使用メモリ | 55,124 KB |
最終ジャッジ日時 | 2024-11-17 15:28:20 |
合計ジャッジ時間 | 20,026 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
ソースコード
// https://yukicoder.me/problems/no/227 fun main() { val a = readln().split(" ").map { it.toInt() }.sorted() val counts = mutableListOf(0, 0, 0, 0, 0) var prev = 0 counts[0] = 1 for(i in 1..4) { if (a[prev] == a[i]){ counts[prev] += 1 } else { prev = i counts[i] = 1 } } var twoCount = 0 var threeCount = 0 for(i in 0..4) { if(counts[i] == 2) twoCount += 1 else if(counts[i] == 3) threeCount += 1 } when { threeCount == 1 && twoCount == 1 -> println("FULL HOUSE") threeCount == 1 -> println("THREE CARD") twoCount == 2 -> println("TWO PAIR") twoCount == 1 -> println("ONE PAIR") else -> println("NO HAND") } }