結果
| 問題 | No.492 IOI数列 | 
| コンテスト | |
| ユーザー |  rickytheta | 
| 提出日時 | 2017-03-10 22:57:24 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 1,578 bytes | 
| コンパイル時間 | 1,379 ms | 
| コンパイル使用メモリ | 165,272 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-24 08:30:18 | 
| 合計ジャッジ時間 | 2,194 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))
// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD
// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;
typedef vector<vi> mat;
mat mul(mat &a,mat &b){
  mat ret(2,vi(2,0));
  REP(i,2)REP(j,2)REP(k,2)ret[i][j]=(ret[i][j]+(ll)a[i][k]*b[k][j]%MOD)%MOD;
  return ret;
}
void deb(mat a){
  printf("%d %d\n",a[0][0],a[0][1]);
  printf("%d %d\n",a[1][0],a[1][1]);
}
int main(){
  ll n;
  cin>>n;
  {
    ll b = n;
    mat a(2,vi(2));
    a[0][0] = 100;
    a[0][1] = 1;
    a[1][0] = 0;
    a[1][1] = 1;
    mat x(2,vi(2,0));
    x[0][0] = x[1][1] = 1;
    while(b){
      if(b&1)x=mul(x,a);
      a=mul(a,a);
      b>>=1;
    }
    ll ans = x[0][1];
    cout<<ans<<endl;
  }
  {
    // 101010101010101010101
    // 1 2 3 4 5 6 7 8 9 0 1
    ll b = n%11;
    ll a = 0;
    REP(i,b){
      a = 100ll*a + 1;
    }
    cout<<a<<endl;
  }
  return 0;
}
            
            
            
        