結果

問題 No.500 階乗電卓
ユーザー MaxMellonMaxMellon
提出日時 2017-07-21 01:36:34
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 217 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 262,256 KB
最終ジャッジ日時 2024-04-17 06:00:14
合計ジャッジ時間 6,139 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 86 ms
12,160 KB
testcase_05 AC 86 ms
12,160 KB
testcase_06 AC 85 ms
12,288 KB
testcase_07 AC 86 ms
12,032 KB
testcase_08 AC 85 ms
12,160 KB
testcase_09 AC 84 ms
12,160 KB
testcase_10 AC 83 ms
12,032 KB
testcase_11 AC 85 ms
12,288 KB
testcase_12 AC 84 ms
12,032 KB
testcase_13 AC 83 ms
12,288 KB
testcase_14 AC 84 ms
12,160 KB
testcase_15 AC 86 ms
12,032 KB
testcase_16 AC 86 ms
12,160 KB
testcase_17 AC 86 ms
12,160 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.chomp.to_i
def fact(n, a = 1)
  return a if n == 0
  fact n - 1, a * n
end

s = fact(n).to_s

ans = []
s.to_s.split('').reverse.each_with_index do |i, j|
  break if j >= 12
  ans.unshift i
end

puts ans.join
0