結果
問題 | No.492 IOI数列 |
ユーザー |
![]() |
提出日時 | 2017-03-10 21:51:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 788 bytes |
コンパイル時間 | 544 ms |
コンパイル使用メモリ | 64,840 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 07:56:18 |
合計ジャッジ時間 | 1,366 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#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 %= 11;if(n == 0) cout << "0" << endl;else {cout << "1";for(int i = 1; i < n; i++) cout << "01";cout << endl;}return 0;}