結果

問題 No.988 N×Mマス計算(総和)
ユーザー rhincodon66rhincodon66
提出日時 2020-02-14 21:44:48
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 739 ms / 2,000 ms
コード長 588 bytes
コンパイル時間 14,495 ms
コンパイル使用メモリ 425,012 KB
実行使用メモリ 69,128 KB
最終ジャッジ日時 2023-09-20 11:43:50
合計ジャッジ時間 25,106 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 309 ms
57,068 KB
testcase_01 AC 316 ms
57,032 KB
testcase_02 AC 321 ms
57,028 KB
testcase_03 AC 316 ms
57,028 KB
testcase_04 AC 314 ms
57,052 KB
testcase_05 AC 317 ms
57,036 KB
testcase_06 AC 324 ms
57,120 KB
testcase_07 AC 318 ms
57,136 KB
testcase_08 AC 321 ms
57,068 KB
testcase_09 AC 314 ms
57,316 KB
testcase_10 AC 555 ms
61,556 KB
testcase_11 AC 584 ms
64,184 KB
testcase_12 AC 709 ms
67,264 KB
testcase_13 AC 588 ms
63,532 KB
testcase_14 AC 571 ms
63,048 KB
testcase_15 AC 491 ms
59,828 KB
testcase_16 AC 658 ms
62,944 KB
testcase_17 AC 714 ms
64,976 KB
testcase_18 AC 624 ms
65,292 KB
testcase_19 AC 688 ms
65,064 KB
testcase_20 AC 739 ms
69,128 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used
fun main(args:Array<String>){
         ^
Main.kt:13:9: warning: variable 'suma' is never used
    val suma = a.sum() % k
        ^

ソースコード

diff #

import java.util.*

fun main(args:Array<String>){
    val (n,m,k) = readLine()!!.split(" ").map{it.toInt()}
    val tmp = readLine()!!.split(" ")
    val op = tmp[0]
    val b = tmp.drop(1).map{it.toLong()}
    val a = LongArray(n)
    for(i in 0 until n){
        a[i] = readLine()!!.toLong()
    }
    var ans = 0L
    val suma = a.sum() % k
    val sumb = b.sum() % k
    for(i in 0 until n){
        ans += if (op == "+") a[i] * m else a[i] * sumb
        ans %= k
    }
    for(i in 0 until m) {
        ans += if (op == "+") b[i] * n else 0
        ans %= k
    }
    println(ans)
}
0