結果

問題 No.780 オフ会
ユーザー @abcde
提出日時 2019-02-03 01:05:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 1,344 ms
コンパイル使用メモリ 158,340 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 05:28:17
合計ジャッジ時間 2,029 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    
    // 1. 入力情報取得.
    int A, B;
    cin >> A >> B;
    
    // 2. ヤスオくんが女の子とペアになって遊べるか?
    bool ok = true;
    int ans = 0;
    if(A + 1 > B)  ok = false, ans = A + 1 - B;
    if(A + 1 <= B) ok = true,  ans = B - (A + 1);

    // 3. 出力.
    cout << (ok ? "YES" : "NO") << endl;
    cout << ans << endl;
    return 0;
    
}
0