結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー monburan_0401
提出日時 2018-10-05 11:37:01
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 28,032 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 12:31:38
合計ジャッジ時間 1,216 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int main(void){
    long int N;     //  number of boxes
    long int K;     //  place of trap
    long int count = 0; //  number of cheeses 'r' can eat

    scanf("%ld %ld",&N,&K);

    if(K != 0 && N >= K){
        count = N;
        if(K == N-K+1){
            count--;
        }else{
            count -= 2;
        }
    }

    printf("%ld\n",count);

    return 0;
}
0