結果
| 問題 | No.933 おまわりさんこいつです |
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2023-02-16 21:26:19 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 304 bytes |
| 記録 | |
| コンパイル時間 | 108 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 52,476 KB |
| 最終ジャッジ日時 | 2024-07-18 20:53:28 |
| 合計ジャッジ時間 | 7,498 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 TLE * 1 -- * 1 |
コンパイルメッセージ
Main.rb:15: warning: assigned but unused variable - n Syntax OK
ソースコード
def f(xs,l,r)
if (r-l<1000) then
ans=1
l.upto(r){|i|
ans*=xs[i]
}
return ans
else
m=(l+r)/2
ans=f(xs,l,m)
ans*=f(xs,m+1,r)
return ans
end
end
n=gets.to_i
xs=gets.split(" ").map{|e| e.to_i}
ans=f(xs,0,xs.size-1)
while ans>9 do
ans=ans.to_s.split("").map{|e| e.to_i}.sum
end
puts ans
horiesiniti