結果

問題 No.194 フィボナッチ数列の理解(1)
ユーザー fjafjafjafjafjafja
提出日時 2017-07-18 13:47:03
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 572 bytes
コンパイル時間 4,075 ms
コンパイル使用メモリ 79,644 KB
実行使用メモリ 56,256 KB
最終ジャッジ日時 2024-04-17 01:55:48
合計ジャッジ時間 14,578 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 164 ms
41,992 KB
testcase_01 AC 168 ms
42,428 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 190 ms
46,072 KB
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)));

	}

}
0