提出 #155712
ソースコード 拡げる
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
s.close();
BigInteger[] aa = new BigInteger[1000001];
aa[1] = new BigInteger("0");
aa[2] = new BigInteger("0");
aa[3] = new BigInteger("1");
for(int i = 4; i <= 1000000; i++){
aa[i] = aa[i - 1].add(aa[i - 2]).add(aa[i - 3]);
}
BigInteger l = new BigInteger("10007");
if (n == 1 || n== 2) {
System.out.println(0);
} else if (n == 3){
System.out.println(aa[n].remainder(l));
} else {
System.out.println(aa[n].remainder(l));
}
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - トリボナッチ数列 |
| ユーザ | kon23 |
| 言語 | Java (OpenJDK 1.7.0) |
| 得点 | 0 |
| コード長 | 694 Byte |
| 結果 | TLE |
| 実行時間 | 2658 ms |
| メモリ | 272636 KiB |
ジャッジ結果
| セット名 | All | ||
|---|---|---|---|
| 得点 / 配点 | 0 / 100 | ||
| 結果 |
|
| セット名 | テストケース |
|---|---|
| All | test_1.txt, test_1000000.txt, test_1002.txt, test_104.txt, test_107843.txt, test_10980.txt, test_1212.txt, test_1238.txt, test_13194.txt, test_14.txt, test_16.txt, test_2.txt, test_210782.txt, test_21694.txt, test_243.txt, test_24916.txt, test_278.txt, test_3.txt, test_31.txt, test_32.txt, test_42.txt, test_5555.txt, test_567914.txt, test_61868.txt, test_765671.txt, test_8195.txt, test_8353.txt, test_9.txt, test_9625.txt, test_97.txt, test_998.txt, test_999998.txt, test_999999.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| sample_01.txt | TLE | 2622 ms | 272500 KiB |
| sample_02.txt | TLE | 2563 ms | 272528 KiB |
| sample_03.txt | TLE | 2479 ms | 272388 KiB |
| test_1.txt | TLE | 2595 ms | 272504 KiB |
| test_1000000.txt | TLE | 2530 ms | 272396 KiB |
| test_1002.txt | TLE | 2658 ms | 272528 KiB |
| test_104.txt | TLE | 2627 ms | 272576 KiB |
| test_107843.txt | TLE | 2645 ms | 272432 KiB |
| test_10980.txt | TLE | 2635 ms | 272516 KiB |
| test_1212.txt | TLE | 2632 ms | 272512 KiB |
| test_1238.txt | TLE | 2448 ms | 272516 KiB |
| test_13194.txt | TLE | 2414 ms | 272384 KiB |
| test_14.txt | TLE | 2522 ms | 272548 KiB |
| test_16.txt | TLE | 2445 ms | 272520 KiB |
| test_2.txt | TLE | 2478 ms | 272516 KiB |
| test_210782.txt | TLE | 2469 ms | 272516 KiB |
| test_21694.txt | TLE | 2515 ms | 272636 KiB |
| test_243.txt | TLE | 2432 ms | 272380 KiB |
| test_24916.txt | TLE | 2613 ms | 272492 KiB |
| test_278.txt | TLE | 2493 ms | 272516 KiB |
| test_3.txt | TLE | 2570 ms | 272520 KiB |
| test_31.txt | TLE | 2589 ms | 272484 KiB |
| test_32.txt | TLE | 2425 ms | 272512 KiB |
| test_42.txt | TLE | 2541 ms | 272520 KiB |
| test_5555.txt | TLE | 2458 ms | 272516 KiB |
| test_567914.txt | TLE | 2499 ms | 272524 KiB |
| test_61868.txt | TLE | 2554 ms | 272468 KiB |
| test_765671.txt | TLE | 2604 ms | 272516 KiB |
| test_8195.txt | TLE | 2622 ms | 272516 KiB |
| test_8353.txt | TLE | 2606 ms | 272520 KiB |
| test_9.txt | TLE | 2623 ms | 272524 KiB |
| test_9625.txt | TLE | 2628 ms | 272528 KiB |
| test_97.txt | TLE | 2588 ms | 272448 KiB |
| test_998.txt | TLE | 2628 ms | 272528 KiB |
| test_999998.txt | TLE | 2487 ms | 272520 KiB |
| test_999999.txt | TLE | 2415 ms | 272508 KiB |