結果
| 問題 |
No.492 IOI数列
|
| コンテスト | |
| ユーザー |
tkmst201
|
| 提出日時 | 2017-03-11 00:19:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,701 bytes |
| コンパイル時間 | 926 ms |
| コンパイル使用メモリ | 88,796 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-24 09:16:35 |
| 合計ジャッジ時間 | 1,729 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 19 |
ソースコード
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
#include <ctime>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define INF (1<<29)
#define INFL (1ll<<60)
#define EPS (1e-8)
#define PI (acos(-1))
const ll MOD = 1000000007ll;
vvl multi(vvl &a, vvl &b, ll mod) {
vvl res(a.size(), vl(b[0].size()));
REP(i, a.size()) {
REP(j, b[0].size()) {
REP(k, b.size()) {
res[i][j] += a[i][k] * b[k][j] % mod;
res[i][j] %= mod;
}
}
}
return res;
}
vvl pow(vvl x, int n, ll mod) {
vvl res(x.size(), vl(x.size()));
REP(i, x.size()) res[i][i] = 1;
while (n > 0) {
if (n & 1) res = multi(res, x, mod);
x = multi(x, x, mod);
n >>= 1;
}
return res;
}
vvl init() {
vvl res(2, vl(2));
res[0][0] = 100;
res[0][1] = 1;
res[1][0] = 0;
res[1][1] = 1;
return res;
}
int main() {
ll n;
cin >> n;
vvl now = init();
vvl se(2, vl(1));
se[0][0] = 1;
se[0][1] = 1;
now = pow(now, n, MOD);
now = multi(now, se, MOD);
cout << now[0][1] << endl;
REP(i, n % 11 - 1) printf("10");
printf("1\n");
return 0;
}
tkmst201