結果
| 問題 |
No.1052 電子機器X
|
| コンテスト | |
| ユーザー |
mmn15277198
|
| 提出日時 | 2021-02-07 18:40:35 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 528 bytes |
| コンパイル時間 | 525 ms |
| コンパイル使用メモリ | 68,660 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-04 11:41:43 |
| 合計ジャッジ時間 | 1,574 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 3 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(){
int n , k;
cin >> n >> k;
if(k >= n){
cout << n << endl;
exit(0);
}
int ans;
if(n % 2 == 0){
if(k % 2 == 0)ans = min(k + 1 , n / 2 + 1);
else ans = min(k , n / 2);
}else{
if(k % 2 == 0)ans = min((k + 1) / 2 + (k + 1) / 2 + 1 , n);
else ans = min((k + 1) / 2 + (k + 1) / 2 , n);
}
cout << ans << endl;
return 0;
}
mmn15277198