結果

問題 No.988 N×Mマス計算(総和)
ユーザー MaboyMaboy
提出日時 2021-06-28 07:18:07
言語 Swift
(5.10.0)
結果
WA  
実行時間 -
コード長 369 bytes
コンパイル時間 1,440 ms
コンパイル使用メモリ 135,584 KB
実行使用メモリ 16,532 KB
最終ジャッジ日時 2023-09-07 18:13:38
合計ジャッジ時間 4,192 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,128 KB
testcase_01 AC 3 ms
8,108 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 3 ms
8,064 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 3 ms
8,200 KB
testcase_08 AC 4 ms
8,120 KB
testcase_09 AC 3 ms
8,188 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 115 ms
11,376 KB
testcase_14 WA -
testcase_15 AC 31 ms
8,848 KB
testcase_16 AC 139 ms
12,480 KB
testcase_17 AC 181 ms
14,860 KB
testcase_18 AC 157 ms
13,736 KB
testcase_19 AC 188 ms
13,708 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

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)}
let V = v.reduce(0){($0 + $1)}
if o == "+"{
    t = (n[0] * H + n[1] * V) % n[2]
}else{
    t = (H * V) % n[2]
}
print(t)
0