結果

問題 No.492 IOI数列
ユーザー 37zigen37zigen
提出日時 2017-03-11 00:43:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 116 ms / 1,000 ms
コード長 1,443 bytes
コンパイル時間 2,866 ms
コンパイル使用メモリ 75,624 KB
実行使用メモリ 56,644 KB
最終ジャッジ日時 2023-09-06 14:55:05
合計ジャッジ時間 6,092 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
55,692 KB
testcase_01 AC 106 ms
55,868 KB
testcase_02 AC 105 ms
55,956 KB
testcase_03 AC 108 ms
55,900 KB
testcase_04 AC 104 ms
56,000 KB
testcase_05 AC 111 ms
53,704 KB
testcase_06 AC 106 ms
55,992 KB
testcase_07 AC 107 ms
56,096 KB
testcase_08 AC 104 ms
55,636 KB
testcase_09 AC 107 ms
56,644 KB
testcase_10 AC 105 ms
56,260 KB
testcase_11 AC 105 ms
55,968 KB
testcase_12 AC 105 ms
55,600 KB
testcase_13 AC 116 ms
55,748 KB
testcase_14 AC 109 ms
55,996 KB
testcase_15 AC 105 ms
55,956 KB
testcase_16 AC 106 ms
55,932 KB
testcase_17 AC 105 ms
56,196 KB
testcase_18 AC 109 ms
55,744 KB
testcase_19 AC 110 ms
55,836 KB
testcase_20 AC 109 ms
56,024 KB
testcase_21 AC 111 ms
55,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
import java.util.concurrent.SynchronousQueue;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	static long[][] mx = { { 100, 1 }, { 1, 0 } };
	static long MODULO = 1000000007;
	BigInteger MODULO2 = new BigInteger("101010101010101010101");
	static BigInteger[] arr = new BigInteger[100];

	void run() {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		System.out.println((pow(100, N) - 1 + MODULO) * (pow(99, MODULO - 2) % MODULO) % MODULO);
		BigInteger a = new BigInteger("0");
		arr[0] = a;
		for (int i = 1; i < arr.length; ++i) {
			arr[i] = arr[i - 1].multiply(BigInteger.valueOf(100)).add(BigInteger.ONE).mod(MODULO2);
		}
		System.out.println(arr[(int) (N % 11)]);
	}

	long pow(long a, long n) {
		long ret = 1;
		for (; n > 0; n >>= 1, a = (a * a) % MODULO) {
			if (n % 2 == 1) {
				ret *= a;
				ret %= MODULO;
			}
		}
		return ret;
	}

	long[][] mul(long[][] a, long[][] b) {
		if (a[0].length != b.length)
			throw new AssertionError();
		long[][] ret = new long[a.length][b[0].length];
		for (int i = 0; i < a.length; ++i) {
			for (int j = 0; j < b[0].length; ++j) {
				for (int k = 0; k < a[j].length; ++k) {
					ret[i][j] = (ret[i][j] + a[i][k] * b[k][j]) % MODULO;
				}
			}
		}
		return ret;
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}
0