結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー uafr_cs
提出日時 2017-06-02 22:51:31
言語 Java
(openjdk 23)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 596 bytes
コンパイル時間 2,051 ms
コンパイル使用メモリ 76,568 KB
実行使用メモリ 41,364 KB
最終ジャッジ日時 2024-09-21 23:46:34
合計ジャッジ時間 6,319 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
	
	public static int RANGE = 100;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final long N = sc.nextLong();
		final long K = sc.nextLong();
		
		if(K <= 0 || K > N){
			System.out.println(0);
		}else if(N % 2 == 1 && (K - 1) == (N / 2)){
			System.out.println(N - 1);
		}else{
			System.out.println(N - 2);
		}
	}
}
0