結果
問題 |
No.505 カードの数式2
|
ユーザー |
![]() |
提出日時 | 2017-04-21 23:26:33 |
言語 | Ruby (3.4.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 377 bytes |
コンパイル時間 | 35 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 18,972 KB |
最終ジャッジ日時 | 2024-07-20 17:46:49 |
合計ジャッジ時間 | 3,731 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | -- * 29 |
コンパイルメッセージ
Syntax OK
ソースコード
@n=gets.to_i @a=gets.chomp.split @op=['+', '-', '*'] @r=0 def rec(i, s) if i==@n @r=[@r, s].max return end _s=0 @op.each do |e| # next if e=='/' and @a[i]=='0' # p @a[i+1] case e when '+' _s=s+@a[i].to_i when '-' _s=s-@a[i].to_i when '*' _s=s*@a[i].to_i end rec(i+1, _s) end end rec(1, @a[0].to_i) puts @r