結果
問題 |
No.194 フィボナッチ数列の理解(1)
|
ユーザー |
![]() |
提出日時 | 2017-07-18 13:47:03 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 572 bytes |
コンパイル時間 | 4,487 ms |
コンパイル使用メモリ | 79,260 KB |
実行使用メモリ | 56,244 KB |
最終ジャッジ日時 | 2024-10-08 10:50:31 |
合計ジャッジ時間 | 14,495 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 1 |
other | AC * 1 RE * 17 TLE * 1 -- * 18 |
ソースコード
import java.util.Scanner; public class N194 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int N=sc.nextInt(); int K=sc.nextInt(); int[] A=new int[N+1]; int[] F=new int[K+1]; for(int i=1;i<N+1;i++) { A[i]=sc.nextInt(); } for(int k=1;k<=K;k++) { if(k<=N) { F[k]=A[k]; } if(N<k) { for(int i=1;i<=N;i++) { F[k]+=F[k-i]; } } } int S=0; for(int k=1;k<=K;k++) { S+=F[k]; } System.out.println(F[K]%((int)(Math.pow(10,9)+7))+" "+S%((int)(Math.pow(10, 9)+7))); } }