結果

問題 No.492 IOI数列
ユーザー maroon_kurimaroon_kuri
提出日時 2017-03-10 23:41:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 2,116 bytes
コンパイル時間 1,211 ms
コンパイル使用メモリ 147,084 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 14:36:06
合計ジャッジ時間 2,215 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;
const int mod=1000000007;

struct Mat{
	int buf[2][2];
	Mat operator*(const Mat& rhs)const{
		Mat ret{};
		REP(i,2)REP(j,2)REP(k,2)
			ret.buf[i][j]=(ret.buf[i][j]+buf[i][k]*rhs.buf[k][j])%mod;
		return ret;
	}
};

void Wafrelka(int n){
	if(n==0){
		cout<<0<<endl;
		return;
	}
	n--;
	Mat ans,adv;
	ans.buf[0][0]=1;
	ans.buf[0][1]=0;
	ans.buf[1][0]=0;
	ans.buf[1][1]=1;
	adv.buf[0][0]=100;
	adv.buf[0][1]=1;
	adv.buf[1][0]=0;
	adv.buf[1][1]=1;
	while(n){
		if(n&1)ans=ans*adv;
		adv=adv*adv;
		n/=2;
	}
	cout<<(ans.buf[0][0]+ans.buf[0][1])%mod<<endl;
}

signed main(){
	int n=read();
	Wafrelka(n);
	n=n%11;
	if(n==0)
		cout<<0<<endl;
	else
		REP(i,n){
			if(i)cout<<0;
			cout<<1;
			if(i==n-1)cout<<endl;
		}
}
0