結果
問題 | No.1052 電子機器X |
ユーザー |
![]() |
提出日時 | 2020-05-15 22:11:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 561 bytes |
コンパイル時間 | 2,388 ms |
コンパイル使用メモリ | 214,704 KB |
最終ジャッジ日時 | 2025-01-10 11:41:58 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
#define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } #include <bits/stdc++.h> using namespace std; int main(){ ll n,k; cin>>n>>k; if(n%2==0){ if(k+1<=n/2) cout<<k+1<<endl; else cout<<n/2<<endl; } else{ if(k+1<=n) cout<<k+1<<endl; else cout<<n<<endl; } return 0; }