結果

問題 No.933 おまわりさんこいつです
ユーザー 👑 horiesinitihoriesiniti
提出日時 2023-02-16 21:26:19
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,408 ms / 2,000 ms
コード長 304 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 11,568 KB
実行使用メモリ 137,148 KB
最終ジャッジ日時 2023-09-26 01:27:58
合計ジャッジ時間 6,992 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,176 KB
testcase_01 AC 81 ms
15,268 KB
testcase_02 AC 80 ms
15,248 KB
testcase_03 AC 81 ms
15,240 KB
testcase_04 AC 80 ms
15,304 KB
testcase_05 AC 84 ms
15,332 KB
testcase_06 AC 80 ms
15,164 KB
testcase_07 AC 81 ms
15,268 KB
testcase_08 AC 82 ms
15,416 KB
testcase_09 AC 81 ms
15,256 KB
testcase_10 AC 81 ms
15,232 KB
testcase_11 AC 83 ms
15,584 KB
testcase_12 AC 82 ms
15,628 KB
testcase_13 AC 90 ms
18,028 KB
testcase_14 AC 93 ms
18,132 KB
testcase_15 AC 111 ms
19,968 KB
testcase_16 AC 190 ms
28,528 KB
testcase_17 AC 190 ms
38,540 KB
testcase_18 AC 79 ms
15,064 KB
testcase_19 AC 240 ms
55,860 KB
testcase_20 AC 173 ms
26,876 KB
testcase_21 AC 79 ms
15,092 KB
testcase_22 AC 79 ms
15,216 KB
testcase_23 AC 1,364 ms
131,784 KB
testcase_24 AC 1,408 ms
137,148 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:15: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

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
0