結果

問題 No.988 N×Mマス計算(総和)
ユーザー wonda_t_coffeewonda_t_coffee
提出日時 2020-02-14 21:40:33
言語 Ruby
(3.3.0)
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 253 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 11,288 KB
実行使用メモリ 26,792 KB
最終ジャッジ日時 2023-09-20 11:39:00
合計ジャッジ時間 3,590 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,076 KB
testcase_01 AC 78 ms
15,140 KB
testcase_02 AC 79 ms
15,336 KB
testcase_03 AC 79 ms
15,084 KB
testcase_04 AC 79 ms
15,312 KB
testcase_05 AC 79 ms
15,132 KB
testcase_06 AC 80 ms
15,048 KB
testcase_07 AC 80 ms
15,232 KB
testcase_08 AC 80 ms
15,112 KB
testcase_09 AC 79 ms
15,232 KB
testcase_10 AC 111 ms
16,896 KB
testcase_11 AC 119 ms
22,292 KB
testcase_12 AC 163 ms
26,160 KB
testcase_13 AC 115 ms
20,684 KB
testcase_14 AC 108 ms
20,812 KB
testcase_15 AC 118 ms
16,256 KB
testcase_16 AC 148 ms
21,460 KB
testcase_17 AC 169 ms
23,872 KB
testcase_18 AC 117 ms
21,812 KB
testcase_19 AC 154 ms
25,060 KB
testcase_20 AC 192 ms
26,792 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, m, k = gets.chomp.split.map(&:to_i)

b = gets.chomp.split
op = b.shift
b = b.map(&:to_i)

a = [] * n
n.times do
  a << gets.chomp.to_i
end

sum_a = a.sum
sum_b = b.sum

if op == '+'
  puts (n * sum_b + m * sum_a) % k
else
  puts sum_a * sum_b % k
end
0