結果
問題 | No.492 IOI数列 |
ユーザー |
![]() |
提出日時 | 2017-03-11 01:49:56 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,741 bytes |
コンパイル時間 | 926 ms |
コンパイル使用メモリ | 90,496 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-06-24 09:29:59 |
合計ジャッジ時間 | 1,578 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 1 |
ソースコード
#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; }