結果

問題 No.194 フィボナッチ数列の理解(1)
ユーザー ki_ki33ki_ki33
提出日時 2015-04-26 23:40:13
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,507 bytes
コンパイル時間 2,432 ms
コンパイル使用メモリ 82,032 KB
実行使用メモリ 60,320 KB
最終ジャッジ日時 2023-09-18 11:49:26
合計ジャッジ時間 9,254 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
60,320 KB
testcase_01 AC 126 ms
55,720 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
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.awt.Point;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentSkipListSet;

public class Main {
	static final int C =  1000000007;
	static final int CY = 1000000000;

	//long[] F;
	
	public void calc() {
		StringBuilder sb = new StringBuilder();
		BufferedInputStream bs = new BufferedInputStream(System.in);
		Scanner sc = new Scanner(bs);

		int n = sc.nextInt();
		long k = sc.nextLong();
		long[] a = new long[n];
		long flen = Math.min(Integer.MAX_VALUE, k);
		
		//F = new long[(int)flen];
		for (int i=0; i < n; i++) {
			a[i] = sc.nextInt();
			//F[i] = a[i];
		}
		
		long ansF = 0;
		long ansS = 0;
		//double ans = 0.0;
		long[] nums;
		nums = a.clone();
		int index = 0;
		for (int i=0; i < k; i++) {
			long now;
			if (i >= n) {
				now = nums[index];
			}else {
				now = a[index];
			}
			
			nums[index] = 0;
			for (int t=0;t < n; t++) {
				nums[t] = mod(nums[t] + now);
			}
			
			index++;
			
			ansS = mod(ansS+now);
			
			if (i == k-1) {
				ansF = now % C;
			}
			if (index >= n) {
				index = 0;
			}
		}

		

		System.out.printf("%d %d",ansF, ansS);
		System.out.println();

	}

	
	long mod(long num) {
		if (num >= C) {
			num -= C;
		}
		
		return num;
	}


	public static void main(String[] args) {
		Main main = new Main();
		main.calc();

	}
}
0