結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー fal_rndfal_rnd
提出日時 2017-08-25 23:32:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 2,336 ms
コンパイル使用メモリ 78,968 KB
実行使用メモリ 54,212 KB
最終ジャッジ日時 2024-04-23 15:46:49
合計ジャッジ時間 7,000 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
54,144 KB
testcase_01 AC 131 ms
54,124 KB
testcase_02 AC 129 ms
53,948 KB
testcase_03 AC 132 ms
53,900 KB
testcase_04 AC 129 ms
53,972 KB
testcase_05 AC 129 ms
53,996 KB
testcase_06 AC 125 ms
54,052 KB
testcase_07 AC 129 ms
54,196 KB
testcase_08 AC 130 ms
53,868 KB
testcase_09 AC 129 ms
54,092 KB
testcase_10 AC 128 ms
53,960 KB
testcase_11 AC 132 ms
53,880 KB
testcase_12 AC 130 ms
53,908 KB
testcase_13 AC 132 ms
53,756 KB
testcase_14 AC 127 ms
53,928 KB
testcase_15 AC 131 ms
53,908 KB
testcase_16 AC 128 ms
53,976 KB
testcase_17 AC 130 ms
54,188 KB
testcase_18 AC 129 ms
54,096 KB
testcase_19 AC 129 ms
53,836 KB
testcase_20 AC 128 ms
54,076 KB
testcase_21 AC 129 ms
54,192 KB
testcase_22 AC 127 ms
53,904 KB
testcase_23 AC 128 ms
54,060 KB
testcase_24 AC 131 ms
54,104 KB
testcase_25 AC 129 ms
53,992 KB
testcase_26 AC 128 ms
54,212 KB
testcase_27 AC 132 ms
53,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
	static IntStream INS(int n) {return REPS(n).map(i->getInt());}
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}

	public static void main(String[]$){
		int n=getInt(),d=getInt();
		System.out.println(d==0||d>n?0:n%2==1&&n/2+1==d?n-1:n-2);
	}
}
0