結果

問題 No.533 Mysterious Stairs
ユーザー fjafjafjafjafjafja
提出日時 2017-07-17 22:47:52
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 554 bytes
コンパイル時間 3,609 ms
コンパイル使用メモリ 74,212 KB
実行使用メモリ 46,380 KB
最終ジャッジ日時 2024-04-17 00:01:41
合計ジャッジ時間 10,857 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
41,216 KB
testcase_01 AC 121 ms
41,196 KB
testcase_02 AC 116 ms
41,276 KB
testcase_03 AC 115 ms
40,944 KB
testcase_04 AC 119 ms
41,076 KB
testcase_05 AC 112 ms
41,228 KB
testcase_06 AC 104 ms
41,320 KB
testcase_07 AC 114 ms
41,372 KB
testcase_08 AC 117 ms
40,948 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

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