結果

問題 No.492 IOI数列
ユーザー kktykkty
提出日時 2017-11-06 20:12:57
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,351 bytes
コンパイル時間 1,324 ms
コンパイル使用メモリ 146,016 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-15 19:36:40
合計ジャッジ時間 2,922 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define ALL(a) (a).begin(),(a).end()
#define MOD 1000000007
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 30);
typedef pair<ll,ll> pii;
struct Edge{ ll s,t,c; };
typedef vector<vector<ll>> Graph;
typedef vector<pii> vpii;

ll power(ll a, ll b, ll mod) {
  ll tmp=a;
  ll tmpp=1;
  ll ret=1;
  while(1){
    if(b%(tmpp*2)){
      ret=ret*tmp%mod;
      b-=tmpp;
    }
    if(b==0) break;
    tmp=tmp*tmp%mod;
    tmpp*=2;
  }
  return ret;
}

pii extendedEuclid(ll a,ll b){
  bool swapped=false;
  if(a<b) {swap(a,b);swapped=true;}
  pii x={1,0},y={0,1};
  while(1){
    ll xv=a*x.first+b*x.second;
    ll yv=a*y.first+b*y.second;
    if(yv==0) {if(swapped) return {x.second,x.first}; else return x;}
    ll d=xv/yv;
    swap(x,y);
    y.first-=d*x.first;
    y.second-=d*x.second;
  }
}

ll inverse(ll a,ll mod) {
  return (mod+extendedEuclid(a,mod).first%mod)%mod;
}

int main() {
  ll N; cin>>N;
  ll mod1=1000000007;
  cout<<(power(100,N,mod1)-1)*inverse(99,mod1)%mod1<<endl;
  N%=11;
  if(N==0) {cout<<0<<endl; return 0;}
  REP(i,N-1) cout<<10; cout<<1<<endl;
}
0