5094.Cornhole

Time Limit: 1s Memory Limit: 256MB

Cornhole is a popular game in which players take turns throwing bean bags at an angled board with a hole in its far end. The object is to score points by either landing a bag on the board (one point) or getting the bag in the hole (three points).

3P4HNG2IPE17uAhbDAfzk05oOIWlATp9gMEgzxQd.png

Each player is given four bean bags. Players stand about 30 feet from the board and alternate throwing the bags, on at-a-time, toward the board. After each player has thrown their four bags, cancellation scoring is performed. That is, each player tally’s up their score (three points for each of their bags that went through the hole, and one point for each of their bags that’s on the board). If player 1 has more points than player 2, player one scores the difference in points. If player 2 has more points than player 1, player 2 scores the difference in points. If both players have the same number of points, then neither player scores any points. As an example, suppose that player 1 had two bags go through the hole and one bag on the board and player 2 had four bags on the board. The result is that player 1 would score three points for that round.

For this problem, you will be given the number of bags that each player had go through the hole and the number of bags that stayed on the board. You will calculate who (if anyone) scores any points using cancellation scoring for the round and if so, how many.

Input Format(From the terminal/stdin)

nput consists of two lines. The first line of input contains two space separated non-negative integers $H_1$ and $B_1$, where $H_1$ is the number of bags player 1 got through the hole and $B_1$ is the number of bags player 1 got on the board $(0 \le H_1 +B_1 \le 4)$. The second line of input contains two space separated decimal integers $H_2$ and $B_2$ , where $H_2$ is the number of bags player 2 got through the hole and $B_2$ is the number of bags player 2 got on the board $(0 \le H_2 +B_2 \le 4)$.

Output Format(To the terminal/stdout)

There is a single line of output. If no one scores any points, the output is the string NO SCORE, otherwise, the line contains two space separated decimal integers $P$ and $N$, where $P$ is the player number ($1$ or $2$) and $N$ is the number of points the player scored $(1 \le N \le 12)$.

Sample Input 1

Copy
2 1
0 4
 · \n
 · \n

Sample Output 1

Copy
1 3
 · \n

Sample Input 2

Copy
1 1
0 4
 · \n
 · \n

Sample Output 2

Copy
NO SCORE
  ·     \n

Sample Input 3

Copy
2 2
3 0
 · \n
 · \n

Sample Output 3

Copy
2 1
 · \n
Source: 2022 Great NY Regional

Submit

请先 登录

© 2025 FAQs