結果

問題 No.415 ぴょん
ユーザー fjafjafjafjafjafja
提出日時 2017-09-03 15:51:09
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 462 bytes
コンパイル時間 5,214 ms
コンパイル使用メモリ 74,248 KB
実行使用メモリ 122,664 KB
最終ジャッジ日時 2024-04-24 12:13:48
合計ジャッジ時間 8,980 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
41,380 KB
testcase_01 AC 133 ms
41,464 KB
testcase_02 AC 131 ms
41,276 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 361 ms
122,664 KB
testcase_07 AC 145 ms
42,564 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 133 ms
41,348 KB
testcase_11 AC 133 ms
40,988 KB
testcase_12 AC 122 ms
40,112 KB
testcase_13 AC 134 ms
41,360 KB
testcase_14 AC 133 ms
41,280 KB
testcase_15 AC 134 ms
41,428 KB
testcase_16 AC 130 ms
41,104 KB
testcase_17 AC 130 ms
41,216 KB
testcase_18 AC 135 ms
41,620 KB
testcase_19 AC 133 ms
41,180 KB
testcase_20 AC 115 ms
40,108 KB
testcase_21 RE -
testcase_22 AC 133 ms
41,564 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class N415 {

	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int D=sc.nextInt();
		int[] fl=new int[N];
		int pyon=0;
		int now=0;
		fl[0]=1;
		for(int i=1;i<N;i++)
		{
			fl[i]=0;
		}

		while(fl[(now+D>N-1)?now+D-N:now+D]==0)
		{
			pyon++;
			fl[(now+D>N-1)?now+D-N:now+D]=1;
			now=(now+D>N-1)?now+D-N:now+D;
		}
		System.out.println(pyon);
	}

}
0