結果
問題 |
No.657 テトラナッチ数列 Easy
|
ユーザー |
|
提出日時 | 2018-08-28 00:01:05 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 339 ms / 2,000 ms |
コード長 | 459 bytes |
コンパイル時間 | 1,927 ms |
コンパイル使用メモリ | 74,244 KB |
実行使用メモリ | 51,972 KB |
最終ジャッジ日時 | 2024-07-05 20:58:53 |
合計ジャッジ時間 | 6,070 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
import java.util.Scanner; class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int q=sc.nextInt(),n,t[]=new int[5],a[]=new int[1000000],i,j; for(i=0;i<4;i++) { t[i]=i/3; a[i]=i/3; } for(i=4;i<1000000;i++) { t[4]=(t[0]+t[1]+t[2]+t[3])%17; a[i]=t[4]; for(j=0;j<4;j++) t[j]=t[j+1]; } for(i=0;i<q;i++) { n=sc.nextInt(); System.out.println(a[n-1]); } sc.close(); } }