結果
問題 | No.492 IOI数列 |
ユーザー |
|
提出日時 | 2017-11-06 20:12:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,351 bytes |
コンパイル時間 | 1,169 ms |
コンパイル使用メモリ | 160,052 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-24 04:03:49 |
合計ジャッジ時間 | 1,852 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#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 1000000007typedef 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;}