結果
問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
ユーザー | pirorirori_n712 |
提出日時 | 2018-08-25 03:38:47 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 2,106 ms |
コンパイル使用メモリ | 104,272 KB |
実行使用メモリ | 26,044 KB |
最終ジャッジ日時 | 2023-09-06 02:30:34 |
合計ジャッジ時間 | 4,192 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 60 ms
21,976 KB |
testcase_01 | AC | 60 ms
23,972 KB |
testcase_02 | AC | 60 ms
21,932 KB |
testcase_03 | AC | 59 ms
23,880 KB |
testcase_04 | AC | 59 ms
23,836 KB |
testcase_05 | AC | 60 ms
21,932 KB |
testcase_06 | AC | 59 ms
21,812 KB |
testcase_07 | AC | 60 ms
21,828 KB |
testcase_08 | AC | 60 ms
21,944 KB |
testcase_09 | AC | 61 ms
23,808 KB |
testcase_10 | AC | 70 ms
21,912 KB |
testcase_11 | WA | - |
testcase_12 | AC | 114 ms
23,932 KB |
testcase_13 | WA | - |
testcase_14 | AC | 113 ms
22,004 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(); var before = 0; var current = 1; var 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); } }