結果
問題 | No.492 IOI数列 |
ユーザー | 👑 Nachia |
提出日時 | 2020-09-27 15:45:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 684 bytes |
コンパイル時間 | 1,456 ms |
コンパイル使用メモリ | 166,596 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 12:39:00 |
合計ジャッジ時間 | 2,237 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#include<bits/stdc++.h> using namespace std; using LL = long long; using ULL = unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) const ULL M = 1000000007; struct X { ULL b, c; }; X operator*(X l, X r) { return { l.b * r.b % M, (l.c * r.b + r.c) % M }; } X operator^(X l, ULL i) { if (i == 0) return { 1,0 }; X res = (l * l) ^ (i / 2); if (i % 2 == 1) res = res * l; return res; } int main() { ULL N; cin >> N; X x = { 100,1 }; x = x ^ (N - 1); ULL ans = (x.b + x.c) % M; cout << ans << endl; ULL t = N % 11; if (t == 0) cout << "0" << endl; else { rep(i, t - 1) cout << "10"; cout << "1" << endl; } return 0; }