結果
問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
ユーザー |
![]() |
提出日時 | 2017-09-14 11:04:09 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 453 bytes |
コンパイル時間 | 2,719 ms |
コンパイル使用メモリ | 103,040 KB |
実行使用メモリ | 22,912 KB |
最終ジャッジ日時 | 2024-11-07 19:45:58 |
合計ジャッジ時間 | 7,308 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 TLE * 1 -- * 8 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; public class Hello{ static long fivo(long n){ if(n == 1){ return 0; }else if(n == 2){ return 1; }else{ return fivo(n - 2) + fivo(n - 1); } } public static void Main(){ string[] input = Console.ReadLine().Split(' '); long N = long.Parse(input[0]); long M = long.Parse(input[1]); Console.WriteLine(fivo(N) % M); } }