結果

問題 No.314 ケンケンパ
コンテスト
ユーザー Leonardone
提出日時 2015-12-08 08:27:20
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 870 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 72 ms
コンパイル使用メモリ 21,704 KB
最終ジャッジ日時 2026-02-23 19:59:22
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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

#define arrlen(x) (sizeof(x) / sizeof((x)[0]))

char str[100];
ul a[1000006];
ul *an = a + 3, *an2 = a + 1, *end = a + 1000005; 

int main() {
    
    *an2 = 1UL;
    while (an != end) {
        *(an++) = ((*(an - 3)) + (*(an - 4))) % MD;
    }
    
    int n = 0;
    int k = fread(str, sizeof(char), arrlen(str), stdin);
    str[k - 1]= 0;
    char *p = str;
    while (*p) {
        n = (n * 10) + (int)(*p++ - '0');
    }
    
    ul r = a[n + 4], t;
    
    *(p = str + 98) = '\n';
    while (r) {
        t = r / 10UL;
        *(--p) = '0' + (char)(r - 10UL * t);
        r = t;
    }
    
    fwrite(p, sizeof(char), str + 99 - p, stdout);
    
    return 0;
}

0