結果

問題 No.988 N×Mマス計算(総和)
ユーザー 👑 horiesinitihoriesiniti
提出日時 2023-02-05 15:58:11
言語 Ruby
(3.3.0)
結果
AC  
実行時間 196 ms / 2,000 ms
コード長 210 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 11,516 KB
実行使用メモリ 25,700 KB
最終ジャッジ日時 2023-09-17 07:53:18
合計ジャッジ時間 4,574 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,152 KB
testcase_01 AC 78 ms
15,252 KB
testcase_02 AC 78 ms
15,056 KB
testcase_03 AC 83 ms
15,056 KB
testcase_04 AC 79 ms
15,128 KB
testcase_05 AC 79 ms
15,144 KB
testcase_06 AC 78 ms
15,228 KB
testcase_07 AC 78 ms
15,300 KB
testcase_08 AC 78 ms
15,036 KB
testcase_09 AC 80 ms
15,092 KB
testcase_10 AC 120 ms
17,180 KB
testcase_11 AC 125 ms
22,312 KB
testcase_12 AC 169 ms
25,288 KB
testcase_13 AC 112 ms
20,656 KB
testcase_14 AC 112 ms
20,696 KB
testcase_15 AC 111 ms
15,400 KB
testcase_16 AC 144 ms
20,948 KB
testcase_17 AC 165 ms
22,852 KB
testcase_18 AC 117 ms
21,660 KB
testcase_19 AC 147 ms
23,740 KB
testcase_20 AC 196 ms
25,700 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,m,k=gets.split(" ").map{|e| e.to_i}
xs=gets.chomp.split(" ")
op=xs.shift
s1=xs.map{|e| e.to_i}.sum
ans=0
if op=="+" then
	n.times{
		ans+=s1+gets.to_i*m
	}
else
	n.times{
		ans+=gets.to_i*s1
	}
end
puts ans%k
0