結果

問題 No.988 N×Mマス計算(総和)
ユーザー MaboyMaboy
提出日時 2021-06-28 07:15:52
言語 Swift
(5.10.0)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 1,625 ms
コンパイル使用メモリ 134,732 KB
実行使用メモリ 16,204 KB
最終ジャッジ日時 2023-09-07 18:13:34
合計ジャッジ時間 4,343 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,216 KB
testcase_01 AC 4 ms
8,164 KB
testcase_02 AC 3 ms
8,100 KB
testcase_03 AC 4 ms
8,220 KB
testcase_04 AC 4 ms
8,112 KB
testcase_05 AC 4 ms
8,128 KB
testcase_06 AC 4 ms
8,136 KB
testcase_07 AC 4 ms
8,100 KB
testcase_08 AC 4 ms
8,120 KB
testcase_09 AC 3 ms
8,264 KB
testcase_10 AC 61 ms
10,156 KB
testcase_11 AC 175 ms
14,164 KB
testcase_12 AC 209 ms
14,064 KB
testcase_13 AC 115 ms
11,376 KB
testcase_14 AC 113 ms
11,432 KB
testcase_15 AC 32 ms
8,872 KB
testcase_16 AC 141 ms
12,480 KB
testcase_17 AC 184 ms
13,560 KB
testcase_18 AC 157 ms
14,500 KB
testcase_19 AC 189 ms
14,968 KB
testcase_20 AC 263 ms
16,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let n = readLine()!.split(separator: " ").map{Int($0)!}
let m = readLine()!.split(separator: " ")
let o = m[0]
var h = m[1...].map{Int($0)!}
var v = [Int]()
for _ in 0..<n[0]{
    v += [Int(readLine()!)!]
}
var t = 0
let H = h.reduce(0){($0 + $1) % n[2]}
let V = v.reduce(0){($0 + $1) % n[2]}
if o == "+"{
    t = (n[0] * H + n[1] * V) % n[2]
}else{
    t = (H * V) % n[2]
}
print(t)
0