結果

問題 No.492 IOI数列
ユーザー tkmst201tkmst201
提出日時 2017-03-11 01:49:56
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,741 bytes
コンパイル時間 714 ms
コンパイル使用メモリ 83,744 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-06 15:05:30
合計ジャッジ時間 1,564 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#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 unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;
typedef vector<ull> 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, ll 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() {
	ull n;
	cin >> n;
	
	vvl now = init();
	
	vvl se(2, vl(1));
	se[0][0] = 1;
	se[1][0] = 1;
	
	now = pow(now, n - 1, MOD);
	now = multi(now, se, MOD);
	
	cout << now[0][0] << endl;
	
	REP(i, (ll)(n % 11) - 1) printf("10");
	printf("1\n");
	
	return 0;
}
0