結果

問題 No.492 IOI数列
ユーザー Grenache
提出日時 2017-03-11 00:02:53
言語 Java
(openjdk 23)
結果
AC  
実行時間 138 ms / 1,000 ms
コード長 1,032 bytes
コンパイル時間 3,871 ms
コンパイル使用メモリ 78,268 KB
実行使用メモリ 54,484 KB
最終ジャッジ日時 2024-06-24 09:10:22
合計ジャッジ時間 7,434 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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