結果

問題 No.492 IOI数列
ユーザー GrenacheGrenache
提出日時 2017-03-11 00:02:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 108 ms / 1,000 ms
コード長 1,032 bytes
コンパイル時間 3,466 ms
コンパイル使用メモリ 74,224 KB
実行使用メモリ 56,500 KB
最終ジャッジ日時 2023-09-06 14:45:52
合計ジャッジ時間 6,817 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
55,740 KB
testcase_01 AC 103 ms
55,800 KB
testcase_02 AC 107 ms
55,988 KB
testcase_03 AC 106 ms
55,724 KB
testcase_04 AC 104 ms
55,844 KB
testcase_05 AC 105 ms
55,756 KB
testcase_06 AC 106 ms
55,740 KB
testcase_07 AC 108 ms
55,476 KB
testcase_08 AC 106 ms
55,892 KB
testcase_09 AC 106 ms
56,104 KB
testcase_10 AC 105 ms
55,608 KB
testcase_11 AC 108 ms
55,944 KB
testcase_12 AC 104 ms
55,816 KB
testcase_13 AC 105 ms
56,500 KB
testcase_14 AC 106 ms
55,936 KB
testcase_15 AC 105 ms
56,024 KB
testcase_16 AC 108 ms
55,592 KB
testcase_17 AC 105 ms
56,220 KB
testcase_18 AC 106 ms
55,956 KB
testcase_19 AC 107 ms
55,548 KB
testcase_20 AC 106 ms
56,344 KB
testcase_21 AC 105 ms
55,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder492 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		long n = sc.nextLong();

		long inv99 = pow(99, MOD - 2);

		long an = (pow(100, n) - 1) % MOD * inv99 % MOD;

		pr.println(an);

		n %= 11;

		if (n == 0) {
			pr.println('0');
		} else {
			pr.print('1');
			for (int i = 0; i < n - 1; i++) {
				pr.print("01");
			}
			pr.println();
		}
	}

	private static int MOD = 1_000_000_007;

	private static long pow(int a, long n) {
		long loop = n;
		long ret = 1;
		long x = a;
		while (loop > 0) {
			if (loop % 2 == 1) {
				ret = ret * x % MOD;
			}
			x = x * x % MOD;
			loop /= 2;
		}

		return ret;
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0