結果

問題 No.314 ケンケンパ
コンテスト
ユーザー Leonardone
提出日時 2015-12-08 08:37:53
言語 C90
(gcc 12.3.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 454 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 157 ms
コンパイル使用メモリ 26,180 KB
最終ジャッジ日時 2025-12-10 17:08:39
合計ジャッジ時間 851 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c:1:1: error: C++ style comments are not allowed in ISO C90
    1 | // yukicoder My Practice
      | ^
main.c:1:1: note: (this will be reported only once per input file)

ソースコード

diff #
raw source code

// yukicoder My Practice
// author: Leonardone @ NEETSDKASU
#include <stdio.h>

typedef unsigned long ul;

const ul MD = 1000000007UL;

// 解説読後
// http://yukicoder.me/problems/882/editorial

ul a, b = 1UL, c, ta;

int main(void) {
    
    int n;
    scanf("%d", &n);
    
    while (--n) {
        ta = (b + c) % MD;
        c = b;
        b = a;
        a = ta;
    }

    
    printf("%lu\n", (((a + b) % MD) + c) % MD);
    
    return 0;
}

0