結果
問題 |
No.194 フィボナッチ数列の理解(1)
|
ユーザー |
![]() |
提出日時 | 2015-04-26 23:40:13 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,507 bytes |
コンパイル時間 | 2,181 ms |
コンパイル使用メモリ | 88,252 KB |
実行使用メモリ | 61,236 KB |
最終ジャッジ日時 | 2024-07-05 02:51:00 |
合計ジャッジ時間 | 8,999 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | -- * 37 |
ソースコード
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(); } }