結果

問題 No.533 Mysterious Stairs
ユーザー hotchstarhotchstar
提出日時 2017-08-03 19:41:33
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 725 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 32,640 KB
実行使用メモリ 25,272 KB
最終ジャッジ日時 2024-04-20 01:42:01
合計ジャッジ時間 1,176 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 4 ms
5,376 KB
testcase_21 AC 4 ms
5,376 KB
testcase_22 AC 8 ms
10,880 KB
testcase_23 AC 19 ms
24,960 KB
testcase_24 AC 20 ms
25,272 KB
testcase_25 AC 4 ms
5,376 KB
testcase_26 AC 18 ms
22,016 KB
testcase_27 AC 7 ms
7,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define FOR(i,a,n) for(i=(a);i<(n);i++)
const int MOD=(1e+9)+7;
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
	int i;
	FOR(i,0,b) a[i]=c;
	return;
}
ll dp[3][1000001];
int main(void)
{
	int n,i,j;
	scanf("%d",&n);
	dp[0][1]=dp[1][2]=dp[2][3]=1;
	FOR(i,3,n+1){
		FOR(j,0,3){
			dp[j][i]+=(dp[(j+1)%3][i-j-1]+dp[(j+2)%3][i-j-1])%MOD;
		}
	}
	printf("%lld\n",(dp[0][n]+dp[1][n]+dp[2][n])%MOD);
	return 0;
}
0