結果
| 問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
| コンテスト | |
| ユーザー |
ebicochineal
|
| 提出日時 | 2017-07-05 05:57:02 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 109 ms / 2,000 ms |
| コード長 | 392 bytes |
| コンパイル時間 | 1,863 ms |
| コンパイル使用メモリ | 106,496 KB |
| 実行使用メモリ | 19,328 KB |
| 最終ジャッジ日時 | 2024-10-05 17:25:30 |
| 合計ジャッジ時間 | 2,396 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
コンパイルメッセージ
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;
public class Program {
static void Main(string[] args) {
var L = Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
int N = L[0], M = L[1];
long a = 1, b = 0, t;
for (int i = 0; i < N - 2; ++i) {
t = a;
a = (a + b) % M;
b = t;
}
Console.WriteLine(a);
}
}
ebicochineal