結果
| 問題 | 
                            No.657 テトラナッチ数列 Easy
                             | 
                    
| コンテスト | |
| ユーザー | 
                             dong_feng
                         | 
                    
| 提出日時 | 2018-06-07 23:59:47 | 
| 言語 | C  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 778 bytes | 
| コンパイル時間 | 173 ms | 
| コンパイル使用メモリ | 29,440 KB | 
| 実行使用メモリ | 10,624 KB | 
| 最終ジャッジ日時 | 2024-06-30 10:36:25 | 
| 合計ジャッジ時間 | 4,550 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 TLE * 1 -- * 3 | 
ソースコード
#include <stdio.h>
int modular17(int input){
    while(input>=17){
        input-=17;
    }
    return input;
}
int main(void){
    int query;
    int i,j,k;
    int times;
    int sum;
    int history[4];
    
    scanf("%d",&query);
    for(i=0;i<query;i++){
        scanf("%d",×);
        history[0]=0;
        history[1]=0;
        history[2]=0;
        history[3]=1;
        
        for(j=4;j<times;j++){
            sum=0;
            for(k=0;k<3;k++){
                sum+=modular17(history[k]);
                history[k]=history[k+1];
            }
            history[3]=modular17(sum+history[3]);
        }
        sum=history[3];
        if(times<4){
            sum=history[times-1];
        }
        
        printf("%d\n",sum);
    }
    
    return 0;
}
            
            
            
        
            
dong_feng