結果

問題 No.492 IOI数列
ユーザー square1001square1001
提出日時 2016-08-15 19:40:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 735 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 63,844 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 12:57:07
合計ジャッジ時間 1,891 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,380 KB
testcase_09 WA -
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
4,376 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
// calculate a^b mod m (a < m)
int modpow(long long a, long long b, int m) {
	int ret = 1;
	while (b > 0) {
		if (b & 1) ret = 1LL * ret * a % m;
		a = 1LL * a * a % m;
		b >>= 1;
	}
	return ret;
}
// calculate a^0 + a^1 + a^2 + ... + a^(b-1) mod m (a < m)
int modpowsum(long long a, long long b, int m) {
	if (b == 0) return 0;
	if (b & 1) return (1LL * modpowsum(a, b - 1, m) * a + 1) % m;
	int res = modpowsum(a, b >> 1, m);
	return (1LL * res * (modpow(a, b >> 1, m) + 1)) % m;
}
const int mod = 1000000007;
long long n;
int main() {
	cin >> n;
	cout << modpowsum(100, n, mod) << endl;
	long long x = 0; n %= 9;
	for (int i = 0; i < n; i++) x = x * 100 + 1;
	cout << x << endl;
	return 0;
}
0