結果

問題 No.415 ぴょん
ユーザー fjafjafjafjafjafja
提出日時 2017-09-03 16:01:45
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 512 bytes
コンパイル時間 3,957 ms
コンパイル使用メモリ 77,188 KB
実行使用メモリ 136,760 KB
最終ジャッジ日時 2024-04-24 12:14:04
合計ジャッジ時間 8,272 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
53,944 KB
testcase_01 AC 133 ms
53,660 KB
testcase_02 AC 132 ms
54,000 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 335 ms
136,760 KB
testcase_07 AC 144 ms
56,116 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 137 ms
54,036 KB
testcase_11 AC 134 ms
54,140 KB
testcase_12 AC 134 ms
54,076 KB
testcase_13 AC 135 ms
54,032 KB
testcase_14 AC 134 ms
53,912 KB
testcase_15 AC 133 ms
54,108 KB
testcase_16 AC 134 ms
54,132 KB
testcase_17 AC 135 ms
53,852 KB
testcase_18 AC 131 ms
53,972 KB
testcase_19 AC 135 ms
54,208 KB
testcase_20 AC 132 ms
54,076 KB
testcase_21 RE -
testcase_22 AC 133 ms
53,892 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class N415
{
	static int N=0;
	static int D=0;

	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		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;
		}
		now=next(now);
		while(fl[now]==0)
		{
			pyon++;
			fl[now]=1;
			now=next(now);
		}
		System.out.println(pyon);
	}

	static int next(int now)
	{
		return (now+D>N-1)?now+D-N:now+D;
	}
}
0