CCC '26 J1 - Concert Tickets
View as PDFCanadian Computing Competition: 2026 Stage 1, Junior #1
Besa wants to buy tickets for the upcoming Saylor Twift concert. Given the total number of tickets for the concert and the number of tickets other people have purchased, your job is to determine whether or not Besa can buy her desired number of tickets.
Input Specification
The first line of input contains a positive integer, , representing the number of tickets Besa
wants to buy. The second line contains a positive integer,
, representing the total number
of tickets for the concert. The third line contains a positive integer,
, where
,
representing the number of tickets other people have purchased.
Output Specification
If Besa cannot buy tickets, output
N. Otherwise, output Y, followed by a single space,
followed by the number of tickets that would remain after Besa buys tickets.
Sample Input 1
5
100
70
Sample Output 1
Y 25
Explanation for Sample Output 1
There are a total of tickets for the concert. Besa wants to buy
tickets and other people
have purchased
tickets. So,
tickets would remain after Besa buys
tickets.
Sample Input 2
3
200000
199998
Sample Output 2
N
Explanation for Sample Output 2
There are a total of tickets for the concert. Besa wants to buy
tickets and other
people have purchased
tickets. So, Besa cannot buy
tickets.
Comments