题解:P15536 [CCC 2026 J1] Concert Tickets

· · 题解

题解:P15536 [CCC 2026 J1] Concert Tickets

分析:

本题考查的是基础数学知识。
如果 Besa 想要购买的门票 B 数量大于剩余的门票数量 T - P 输出 N。否则输出 Y 和最后剩下的门票数量 T - P - B。

代码实现

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int B,T,P;
    cin>>B>>T>>P;
    if(B+P>T){
        cout<<"N";
    }else{
        cout<<"Y "<<T-P-B;
    }
}

AC 记录 我居然是首 A