結果

問題 No.314 ケンケンパ
ユーザー merumeru_333333
提出日時 2020-05-05 17:12:48
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 30 ms / 1,000 ms
コード長 445 bytes
コンパイル時間 806 ms
コンパイル使用メモリ 108,528 KB
実行使用メモリ 25,796 KB
最終ジャッジ日時 2024-06-26 21:44:13
合計ジャッジ時間 2,126 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class test1
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int a = 1;
        int b = 2;
        int c = 2;
        int bp = (n == 1) ? a : b;
        int r = 1000000007;

        for (int i = 3; i < n; i++)
        {
            bp = (b + a > r) ? (b + a) % r : (b + a);
            a = b;
            b = c;
            c = bp;
        }
        Console.WriteLine(bp);
    }
}
0