結果
| 問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-06-09 22:25:12 | 
| 言語 | D (dmd 2.109.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 87 ms / 2,000 ms | 
| コード長 | 486 bytes | 
| コンパイル時間 | 728 ms | 
| コンパイル使用メモリ | 114,644 KB | 
| 実行使用メモリ | 41,216 KB | 
| 最終ジャッジ日時 | 2024-06-12 19:51:15 | 
| 合計ジャッジ時間 | 1,752 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 | 
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;
immutable long MOD = 10^^9+7;
void main() {
    auto s = readln.split;
    auto N = s[0].to!int;
    auto M = s[1].to!long;
    auto F = new long[](N+1);
    F[0] = 0;
    F[1] = 0;
    F[2] = 1;
    foreach (i; 3..N+1) {
        F[i] = (F[i-1] + F[i-2]) % M;
    }
    F[N].writeln;
}
            
            
            
        