結果
問題 |
No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
|
ユーザー |
|
提出日時 | 2025-02-05 09:59:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 316 bytes |
コンパイル時間 | 857 ms |
コンパイル使用メモリ | 59,516 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-02-05 09:59:22 |
合計ジャッジ時間 | 2,540 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d%d",&n,&k); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include<iostream> #include<cassert> #define rep(i,n) for(i=0;i<(int)(n);i++) using namespace std; typedef long long ll; typedef unsigned long long ull; int n,k; int main(){ scanf("%d%d",&n,&k); if(k==0||k>n){ puts("0"); return 0;; } printf("%d\n",n-(k==n+1-k?1:2)); return 0; }