結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー koba-e964
提出日時 2017-06-10 01:07:15
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 97 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-09-22 21:27:05
合計ジャッジ時間 4,448 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 1 WA * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: `-' after local variable or literal is interpreted as binary operator
Main.rb:2: warning: even though it seems like unary operator
Main.rb:4: warning: assigned but unused variable - i
Syntax OK

ソースコード

diff #

n, m = gets.split.map(&:to_i)
x =m -1
y = 0
for i in 1 .. n
 x, y = [y, x + y]
 y %= m
end
puts x
0