結果
問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
ユーザー | pirorirori_n712 |
提出日時 | 2018-08-25 03:41:57 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 138 ms / 2,000 ms |
コード長 | 473 bytes |
コンパイル時間 | 2,101 ms |
コンパイル使用メモリ | 106,164 KB |
実行使用メモリ | 23,980 KB |
最終ジャッジ日時 | 2023-09-06 02:40:27 |
合計ジャッジ時間 | 4,243 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 59 ms
21,924 KB |
testcase_01 | AC | 59 ms
23,972 KB |
testcase_02 | AC | 60 ms
21,948 KB |
testcase_03 | AC | 60 ms
21,988 KB |
testcase_04 | AC | 59 ms
21,900 KB |
testcase_05 | AC | 59 ms
21,844 KB |
testcase_06 | AC | 59 ms
21,908 KB |
testcase_07 | AC | 59 ms
23,980 KB |
testcase_08 | AC | 59 ms
23,968 KB |
testcase_09 | AC | 60 ms
19,904 KB |
testcase_10 | AC | 74 ms
21,876 KB |
testcase_11 | AC | 138 ms
23,976 KB |
testcase_12 | AC | 138 ms
21,796 KB |
testcase_13 | AC | 138 ms
21,944 KB |
testcase_14 | AC | 137 ms
21,768 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; class No526 { static void Main() { var num = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); long before = 0; long current = 1; long after = (before + current) % num[1]; for (int i = 3; i < num[0]; ++i) { before = current; current = after; after = (before + current) % num[1]; } Console.WriteLine(after); } }