結果

問題 No.533 Mysterious Stairs
ユーザー fjafjafja
提出日時 2017-07-17 22:47:52
言語 Java
(openjdk 23)
結果
TLE  
実行時間 -
コード長 554 bytes
コンパイル時間 3,758 ms
コンパイル使用メモリ 74,280 KB
実行使用メモリ 46,104 KB
最終ジャッジ日時 2024-10-08 07:18:04
合計ジャッジ時間 11,991 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class N533
{
	public static int count =0;
	public static int N=0;

	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		for(int i=1;i<4;i++)
		{
			N533.step(i,0);
		}
		System.out.println(count%(int)(Math.pow(10, 9)*7));
	}

	public static void step(int prestep,int now)
	{
		now+=prestep;
		if(now>=N)
		{
			count=(now==N)?count+1:count;
			return;
		}
		for(int i=1;i<3;i++)
		{
			int step=(prestep+i)%3;
			step=(step==0)?step+3:step;
			N533.step(step,now);
		}
	}
}
0