結果

問題 No.415 ぴょん
ユーザー ym678
提出日時 2016-08-27 21:00:32
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 537 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 74,604 KB
実行使用メモリ 122,744 KB
最終ジャッジ日時 2024-11-08 20:00:23
合計ジャッジ時間 6,818 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 RE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int D = scn.nextInt();
		int[] ling = new int[N];//1は足場がある0は足場がない
		
		for(int i=0; i<N; i++){
			ling[i] = 1;
		}
		
		int t = 0;
		int count = 0;
		for(;;){
			ling[t] = 0;
			if(t + D > N-1){
				t = (t + D - (N-1)) - 1 ;
			}else{
			    t += D;
			}
			if(ling[t] == 0){
				break;
			}else{
				count ++;
			}
		}
		System.out.println(count);
	}
}
	
	
0