結果
| 問題 | No.492 IOI数列 | 
| コンテスト | |
| ユーザー |  tkmst201 | 
| 提出日時 | 2017-03-11 15:45:54 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 1,777 bytes | 
| コンパイル時間 | 871 ms | 
| コンパイル使用メモリ | 89,272 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-24 12:29:45 | 
| 合計ジャッジ時間 | 1,715 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 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 unsigned long long ull;
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, 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() {
	ll 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;
	
	if (n % 11 == 0) puts("0");
	else {
		REP(i, (n % 11) - 1) printf("10");
		printf("1\n");
	}
	
	return 0;
}
            
            
            
        