結果

問題 No.2239 Friday
ユーザー yorry2101
提出日時 2023-06-03 00:06:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 370 bytes
コンパイル時間 707 ms
コンパイル使用メモリ 66,104 KB
最終ジャッジ日時 2025-02-13 21:42:33
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(void){
    int a, b;
    cin >> a >> b;
    int matched = min(a, b) * 2;
    int unmatched = (a + b) - matched;
    
    int d = abs(matched - unmatched);
    for (int i = 0; i < min(a, b); i++) {
        matched -= 2;
        unmatched += 2;
        d = min(d, abs(matched - unmatched));
    }
    cout << d << endl;
}
0