結果
| 問題 |
No.750 Frac #1
|
| コンテスト | |
| ユーザー |
バカらっく
|
| 提出日時 | 2022-02-14 10:32:05 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
AC
|
| 実行時間 | 310 ms / 1,000 ms |
| コード長 | 460 bytes |
| コンパイル時間 | 9,730 ms |
| コンパイル使用メモリ | 427,764 KB |
| 実行使用メモリ | 55,492 KB |
| 最終ジャッジ日時 | 2024-06-29 06:08:22 |
| 合計ジャッジ時間 | 21,568 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
^
ソースコード
fun main(args: Array<String>) {
val n = readLine()!!.toInt()
val num = (1..n).map { readLine()!!.split(" ").map { it.toInt() }.let { Num(it[0], it[1]) } }.sortedDescending()
num.forEach { println("${it.a} ${it.b}") }
}
class Num(val a:Int, val b:Int):Comparable<Num> {
override fun compareTo(other: Num): Int {
if(b == other.b) {
return a.compareTo(other.a)
}
return (a*other.b).compareTo(other.a*b)
}
}
バカらっく