結果
問題 |
No.1052 電子機器X
|
ユーザー |
|
提出日時 | 2022-02-01 09:55:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 459 bytes |
コンパイル時間 | 1,374 ms |
コンパイル使用メモリ | 166,164 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-11 09:07:48 |
合計ジャッジ時間 | 2,217 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int ans = 0; if(2 * k + 1 <= n) ans = (2 * k + 1) / 2 + 1; else { int low = (-k) % n; int high = k % n; if(low < 0) low += n; if(abs(low - high) % 2 == 0) { ans = n / 2; if(k % 2 == 0 && n % 2 == 1) ans++; } else ans = min(n, (2 * k + 1) / 2 + 1); } cout << ans << endl;; }