QOJ.ac

QOJ

ID提交记录ID题目HackerOwner结果提交时间测评时间
#570#234982#7062. Prince and Princess111445nekoSuccess!2024-03-10 21:15:142024-03-10 21:15:15

详细

Extra Test:

Wrong Answer
time: 0ms
memory: 3688kb

input:

1 5 2

output:

YES
7

result:

wrong answer 1st lines differ - expected: 'NO', found: 'YES'

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#234982#7062. Prince and PrincessnekoWA 0ms3692kbC++14584b2023-11-02 09:50:082024-03-10 21:15:22

answer

#include<bits/stdc++.h>

#define ll long long
using namespace std;

int f, t, a;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> t >> f >> a;
    if(t+f+a == 1){
        cout << "YES" << endl;
        cout << 0 << endl;
        return 0;
    }
    if (abs(f - t) <= a) {
        cout << "NO" << endl;
        return 0;
    }
    if(!((t>a&&t>f)||(t<a&&t<f))){
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
    cout << 2 * (min(f, t) + a) + 1 << endl;
    return 0;
}