結果
| 問題 |
No.492 IOI数列
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-02-03 13:30:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 847 bytes |
| コンパイル時間 | 1,871 ms |
| コンパイル使用メモリ | 61,696 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-02-03 13:30:11 |
| 合計ジャッジ時間 | 2,364 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll; const int Mod=1e9+7;
struct Matrix {
ll a[5][5];
Matrix() { for(int i=1;i<=2;i++) for(int j=1;j<=2;j++) a[i][j]=0; }
void build() { for(int i=1;i<=2;i++) a[i][i]=1; }
};
Matrix operator *(const Matrix &a,const Matrix &b) {
Matrix c;
for(int k=1;k<=2;k++) for(int i=1;i<=2;i++) for(int j=1;j<=2;j++) c.a[i][j]=(c.a[i][j]+a.a[i][k]*b.a[k][j]%Mod)%Mod;
return c;
}
int main() {
//freopen("ioi.in","r",stdin);
//freopen("ioi.out","w",stdout);
ios::sync_with_stdio(false),cin.tie(nullptr);
ll n,t; Matrix a,ans; cin>>n,a.a[1][1]=100,a.a[1][2]=a.a[2][2]=1,ans.build(),t=n;
while(t) {
if(t&1) ans=ans*a;
a=a*a,t>>=1;
}
cout<<ans.a[1][2]<<'\n';
if(!(n%11)) return cout<<0,0;
cout<<1;
for(int i=1;i<n%11;i++) cout<<"01";
return 0;
}
vjudge1