結果

問題 No.415 ぴょん
ユーザー fjafjafja
提出日時 2017-09-03 15:51:09
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 462 bytes
コンパイル時間 4,051 ms
コンパイル使用メモリ 74,728 KB
実行使用メモリ 122,476 KB
最終ジャッジ日時 2024-11-06 20:03:43
合計ジャッジ時間 9,142 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 RE * 10
権限があれば一括ダウンロードができます

ソースコード

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