結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー donkorin_donkorin_
提出日時 2017-06-02 23:05:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 409 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 64,652 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 01:29:57
合計ジャッジ時間 10,171 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;

int main() {
  long long int n,k;
  long long int cnt=0;
  cin>>n>>k;
  long long int A[n];
  for(int i=0;i<n;i++) {
    A[i] = 0;
    A[k] = 1; A[n-k+1] = 1;
    if(A[i] == 0) cnt = cnt + 1;
  }
  if((n==1 && k==1) || (n==2 && k==2)) cout<<0<<endl;
  else if(n-k < 0 || k == 0) cout<<0<<endl;
  else cout<<cnt<<endl;

  return 0;
}
0