結果

問題 No.314 ケンケンパ
ユーザー fal_rnd
提出日時 2016-12-25 00:32:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 4 ms / 1,000 ms
コード長 398 bytes
コンパイル時間 1,366 ms
コンパイル使用メモリ 158,188 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 18:38:05
合計ジャッジ時間 2,142 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const char en='\n';

const int mod=1000000007;
void calc(ll& a,ll& b,ll& c){//10,01,11
	ll bufa=b+c,bufb=a,bufc=b;
	a=bufa%mod;
	b=bufb%mod;
	c=bufc%mod;
}
int main(){
	cin.tie();
	ios::sync_with_stdio(false);
	ll a=0,b=1,c=0;
	int in;
	cin>>in;
	for(int i=0;i<in-1;i++){
		calc(a,b,c);
	}
	cout<<(a+b+c)%mod<<en;
	return 0;
}
0