結果

問題 No.415 ぴょん
ユーザー ym678ym678
提出日時 2016-08-27 21:00:32
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 537 bytes
コンパイル時間 1,944 ms
コンパイル使用メモリ 74,680 KB
実行使用メモリ 136,552 KB
最終ジャッジ日時 2024-04-26 07:01:54
合計ジャッジ時間 6,812 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
54,036 KB
testcase_01 AC 128 ms
54,048 KB
testcase_02 AC 126 ms
53,740 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 317 ms
136,552 KB
testcase_07 AC 137 ms
56,012 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 127 ms
54,028 KB
testcase_11 AC 129 ms
53,880 KB
testcase_12 AC 128 ms
54,072 KB
testcase_13 AC 129 ms
53,924 KB
testcase_14 AC 116 ms
53,008 KB
testcase_15 AC 125 ms
54,064 KB
testcase_16 AC 126 ms
54,080 KB
testcase_17 AC 115 ms
53,184 KB
testcase_18 AC 134 ms
53,980 KB
testcase_19 AC 133 ms
53,932 KB
testcase_20 AC 125 ms
53,972 KB
testcase_21 RE -
testcase_22 AC 122 ms
53,748 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます

ソースコード

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