結果

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

ソースコード

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