結果
問題 | No.492 IOI数列 |
ユーザー |
![]() |
提出日時 | 2017-03-12 00:47:13 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,259 bytes |
コンパイル時間 | 625 ms |
コンパイル使用メモリ | 84,664 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 14:03:02 |
合計ジャッジ時間 | 1,457 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
/* -*- coding: utf-8 -*-** 492.cc: No.492 IOI数列 - yukicoder*/#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<iostream>#include<string>#include<vector>#include<map>#include<set>#include<stack>#include<list>#include<queue>#include<deque>#include<algorithm>#include<numeric>#include<utility>#include<complex>#include<functional>using namespace std;/* constant */typedef long long ll;const ll MOD = 1000000007;/* typedef */struct Mat {ll s, t;ll u, v;Mat() {}Mat(ll _s, ll _t, ll _u, ll _v): s(_s), t(_t), u(_u), v(_v) {};Mat operator*(const Mat &m) const {returnMat((s * m.s + t * m.u) % MOD, (s * m.t + t * m.v) % MOD,(u * m.s + v * m.u) % MOD, (u * m.t + v * m.v) % MOD);}Mat pow(ll n) const {Mat r(1, 0, 0, 1), a(*this);while (n > 0) {if ((n & 1) > 0) r = r * a;a = a * a;n >>= 1;}return r;}};/* global variables *//* subroutines *//* main */int main() {ll n;cin >> n;Mat m(Mat(100, 1, 0, 1).pow(n));printf("%lld\n", m.t);int k = n % 11;if (k == 0) puts("0");else {for (int i = 1; i < k; i++) putchar('1'), putchar('0');putchar('1'), putchar('\n');}return 0;}