結果

問題 No.303 割れません
ユーザー cielciel
提出日時 2015-11-16 19:51:51
言語 Ruby
(3.3.0)
結果
AC  
実行時間 295 ms / 10,000 ms
コード長 145 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 11,344 KB
実行使用メモリ 33,956 KB
最終ジャッジ日時 2023-10-11 16:55:38
合計ジャッジ時間 4,673 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
15,660 KB
testcase_01 AC 98 ms
15,680 KB
testcase_02 AC 92 ms
15,824 KB
testcase_03 AC 183 ms
24,468 KB
testcase_04 AC 294 ms
33,956 KB
testcase_05 AC 288 ms
30,792 KB
testcase_06 AC 295 ms
31,772 KB
testcase_07 AC 238 ms
29,316 KB
testcase_08 AC 246 ms
29,600 KB
testcase_09 AC 247 ms
29,404 KB
testcase_10 AC 94 ms
15,740 KB
testcase_11 AC 292 ms
30,660 KB
testcase_12 AC 247 ms
30,412 KB
testcase_13 AC 221 ms
28,972 KB
testcase_14 AC 147 ms
21,696 KB
testcase_15 AC 142 ms
21,736 KB
testcase_16 AC 94 ms
15,760 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require'matrix'
A=Matrix[[1,1],[1,0]]
def f(n) (A**n)[1,0] end
n=gets.to_i
if n==2
puts 3
puts :INF
else
puts n
puts f(n)-(n%2>0?0:f(n/2)**2)
end
0