結果
| 問題 |
No.565 回転拡大
|
| コンテスト | |
| ユーザー |
💕💖💞
|
| 提出日時 | 2018-06-28 13:24:29 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
AC
|
| 実行時間 | 522 ms / 2,000 ms |
| コード長 | 1,267 bytes |
| コンパイル時間 | 17,329 ms |
| コンパイル使用メモリ | 456,476 KB |
| 実行使用メモリ | 59,292 KB |
| 最終ジャッジ日時 | 2024-11-20 16:29:32 |
| 合計ジャッジ時間 | 28,755 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
^
Main.kt:14:59: warning: parameter 'x' is never used, could be renamed to _
val lambdasy = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> y }, 90 to { y, x -> x }, 180 to { y,x -> h - 1 - y }, 270 to { y,x -> w - 1 - x } )
^
Main.kt:14:77: warning: parameter 'y' is never used, could be renamed to _
val lambdasy = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> y }, 90 to { y, x -> x }, 180 to { y,x -> h - 1 - y }, 270 to { y,x -> w - 1 - x } )
^
Main.kt:14:101: warning: parameter 'x' is never used, could be renamed to _
val lambdasy = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> y }, 90 to { y, x -> x }, 180 to { y,x -> h - 1 - y }, 270 to { y,x -> w - 1 - x } )
^
Main.kt:14:128: warning: parameter 'y' is never used, could be renamed to _
val lambdasy = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> y }, 90 to { y, x -> x }, 180 to { y,x -> h - 1 - y }, 270 to { y,x -> w - 1 - x } )
^
Main.kt:15:56: warning: parameter 'y' is never used, could be renamed to _
val lambdasx = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> x }, 90 to { y, x -> h - 1 - y }, 180 to { y, x -> w - 1 - x }, 270 to { y,x -> y } )
^
Main.kt:15:80: warning: parameter 'x' is never used, could be renamed to _
val lambdasx = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> x }, 90 to { y, x -> h - 1 - y }, 180 to { y, x -> w - 1 - x }, 270 to { y,x -> y } )
^
Main.kt:15:107: warning: parameter 'y' is never used, c
ソースコード
fun main(args:Array<String>) {
val (r, k) = readLine()!!.split(" ").map(String::toInt)
val (h, w) = readLine()!!.split(" ").map(String::toInt)
val orig = (1..h).map { readLine()!!.toList() }
// make base
when(r) {
0 -> (1..h).map { (1..w).map { null }.toMutableList<Char?>() }
90 -> (1..w).map { (1..h).map { null }.toMutableList<Char?>() }
180 -> (1..h).map { (1..w).map { null }.toMutableList<Char?>() }
else -> (1..w).map { (1..h).map { null }.toMutableList<Char?>() }
}.let { base ->
val lambdasy = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> y }, 90 to { y, x -> x }, 180 to { y,x -> h - 1 - y }, 270 to { y,x -> w - 1 - x } )
val lambdasx = mapOf<Int, (Int, Int)->Int>( 0 to { y, x -> x }, 90 to { y, x -> h - 1 - y }, 180 to { y, x -> w - 1 - x }, 270 to { y,x -> y } )
(0..h-1).map { y ->
(0..w-1).map { x ->
val transy = lambdasy[r]!!(y, x)
val transx = lambdasx[r]!!(y, x) //h -1 - x
orig[y][x]
base[transy][transx] = orig[y][x]
//println("$transy $transx $x $y ${base.size} ${base[0].size} ${orig[y][x]}")
}
}
base.map { xs ->
(1..k).map {
xs.map { x ->
(1..k).map { print(x.toString()) }
}
println("")
}
}
}
}
💕💖💞