結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー AOW_MIRROR_O5
提出日時 2018-03-08 17:39:44
言語 Java
(openjdk 23)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 2,975 ms
コンパイル使用メモリ 74,668 KB
実行使用メモリ 41,332 KB
最終ジャッジ日時 2024-10-05 08:05:26
合計ジャッジ時間 6,873 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class paiza7 {
    public static void main(String[] args) {
		
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
		int K = sc.nextInt();
		
		if(K<=0 || K>N){
			System.out.println(0);
		}else if(N%2 == 0){
			System.out.println(N-2);
		}else{
			if((1+N)/2==K){
				System.out.println(N-1);
			}else{
				System.out.println(N-2);
			}
    	}
    }
}
0