結果

問題 No.492 IOI数列
ユーザー maroon_kuri
提出日時 2017-03-10 23:41:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 2,116 bytes
コンパイル時間 1,564 ms
コンパイル使用メモリ 160,808 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-24 09:02:10
合計ジャッジ時間 1,928 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘ll read()’:
main.cpp:38:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   38 |         scanf("%lld",&i);
      |         ~~~~~^~~~~~~~~~~
main.cpp: In function ‘std::string readString()’:
main.cpp:60:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   60 |         scanf("%s",buf);
      |         ~~~~~^~~~~~~~~~
main.cpp: In function ‘char* readCharArray()’:
main.cpp:68:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   68 |         scanf("%s",ret);
      |         ~~~~~^~~~~~~~~~

ソースコード

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;
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0