結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー _matumo__matumo_
提出日時 2018-08-28 17:25:01
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 2,881 ms
コンパイル使用メモリ 102,780 KB
実行使用メモリ 25,936 KB
最終ジャッジ日時 2023-09-23 02:55:10
合計ジャッジ時間 5,473 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
19,760 KB
testcase_01 AC 61 ms
21,784 KB
testcase_02 AC 61 ms
21,752 KB
testcase_03 AC 63 ms
21,776 KB
testcase_04 AC 64 ms
23,832 KB
testcase_05 AC 64 ms
21,852 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YukiCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var va = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int Fa = 0;
            int Fb = 1;
            int Fc = 0;
            for (int i = 2; i < va[0]; i++)
            {
                Fc = Fb + Fa;
                Fa = Fb;
                Fb = Fc;
            }
            Console.WriteLine(Fc % va[1]);
            Console.ReadLine();
        }
    }
}
0