結果

問題 No.988 N×Mマス計算(総和)
ユーザー simansiman
提出日時 2020-02-14 21:29:46
言語 Ruby
(3.3.0)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 229 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 11,376 KB
実行使用メモリ 26,732 KB
最終ジャッジ日時 2023-09-20 11:32:00
合計ジャッジ時間 4,437 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,192 KB
testcase_01 AC 82 ms
15,184 KB
testcase_02 AC 84 ms
15,168 KB
testcase_03 AC 82 ms
15,136 KB
testcase_04 AC 82 ms
15,084 KB
testcase_05 AC 82 ms
15,160 KB
testcase_06 AC 82 ms
15,052 KB
testcase_07 AC 83 ms
15,044 KB
testcase_08 AC 84 ms
15,056 KB
testcase_09 AC 83 ms
15,124 KB
testcase_10 AC 130 ms
17,624 KB
testcase_11 AC 185 ms
23,104 KB
testcase_12 AC 220 ms
26,140 KB
testcase_13 AC 127 ms
21,008 KB
testcase_14 AC 149 ms
20,956 KB
testcase_15 AC 119 ms
16,356 KB
testcase_16 AC 156 ms
21,332 KB
testcase_17 AC 179 ms
22,744 KB
testcase_18 AC 172 ms
22,344 KB
testcase_19 AC 172 ms
22,996 KB
testcase_20 AC 206 ms
26,732 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, M, K = gets.split.map(&:to_i)
op, *B = gets.chomp.split
B.map!(&:to_i)
A = N.times.map { gets.to_i }
S = A.sum
ans = 0

B.each do |b|
  if op == '+'
    ans += N * b + S
  else
    ans += b * S
  end

  ans %= K
end

puts ans
0