-->
当前位置:首页 > 题库

PROGRAMMING:Curling competition

Luz5年前 (2021-05-10)题库371
In the final of the women's curling world championships on March 29,; The Chinese women's curling team, composed of Zhong Zhiying, Chen Jiaheng, ye Hanxi and Fu Yan, beat Sweden, the double champion of the Winter Olympics and World Championships, 8-6, and won the first gold medal of the world championships in Chinese curling history. Beautiful and powerful Chinese curling girls have also won high praise.
In curling competition, give a * * target point P * * and a positive integer R. In each game, team a and team B take turns to throw curling for 8 times, and then the game ends. At this time, which party's curling is closer to the * * target point P * *, the party scores, and the other party does not score. The scoring party can get 1 point for each curling that is less than or equal to r from the * * target point P * *, and whose position is closer to the * * target point P * * than all curling of the other team.
The maximum number of games is 10. After the end of a game between the two sides, the lagging party can abstain. At this point, the game is no longer going on.
Given the distance between each curling of both sides and the * * target point P * * at the end of each game, and the positive integer R, please write a program to judge the score of each game between the two teams, as well as the total score.
###Input format:
The first line has only one positive integer R.
There are several lines (no more than 20 lines) below. Except for the last line, each line has 8 positive integers (separated by a space).
The j-th number in the second line indicates the distance between Party A's j-th curling and the target point P at the end of the first game;
The j-th number in the third line indicates the distance between the j-th curling of Party B and the target point P at the end of the first game;
The number J in line 4 indicates the distance between Party A's J curling and the target point P at the end of the second game;
The j-th number in line 5 indicates the distance between the j-th curling of Party B and the target point P at the end of the second game;
… …
The j-th number in line 2K indicates the distance between Party A's j-th curling and the target point P at the end of the k-th game;
The j-th number in line 2K + 1 indicates the distance between the j-th curling of Party B and the target point P at the end of the k-th game;
If one party abstains midway, the last line (even number line) has only one integer - 1, which indicates that the abstention occurs at this time.
###Output format:
There are several lines, each line has two integers, separated by a colon in the middle, indicating the score of Party A and Party B in each game (Party A scores first).
There are two integers in the last line, separated by a colon in the middle, indicating the final score of the game between Party A and Party B (Party A scores first).
###Input sample 1:
```
eight
5 20 18 19 3 15 13 3
20 2 17 12 5 18 10 11
20 3 4 1 2 11 9 2
1 15 19 9 8 14 11 10
15 2 10 1 19 14 3 18
15 17 21 19 24 32 19 26
-1
```
###Output sample 1:
```out
0:1
0:0
3:0
3:1
```
###Input sample 2:
```
eight
5 20 18 19 3 15 13 3
20 2 17 12 5 18 10 11
20 3 4 1 2 11 9 2
1 15 19 9 8 14 11 10
15 2 10 1 19 14 3 18
15 17 21 19 24 32 19 26
5 1 14 13 15 2 3 11
14 7 5 19 10 12 6 9
3 14 9 8 4 8 3 10
14 6 9 4 8 2 1 5
9 8 1 2 8 8 7 18
16 8 20 19 3 1 10 5
2 13 19 2 18 9 18 3
6 5 5 20 6 17 2 18
17 3 20 6 9 3 17 17
20 10 8 12 19 19 18 20
15 18 4 18 17 14 5 16
6 14 8 14 19 7 13 7
15 9 2 8 20 3 10 14
8 6 3 2 4 11 4 10
```
###Output sample 2:
```
0:1
0:0
3:0
3:0
0:2
0:0
0:0
3:0
2:0
0:0
11:3
```
[example description]
In examples 1 and 2:
In the first game, the nearest distance between Party A and target point P is 3, and the nearest distance between Party B and target point P is 2, and Party B scores. Party B has only one value (2 pots) smaller than Party A's 3, so Party B gets 1 point.
In the second game, the nearest distance between Party A and the target point P is 1, and the nearest distance between Party B and the target point P is 1. Neither party will score.
In the third game, the nearest distance between Party A and target point P is 1, and the nearest distance between Party B and target point P is 15, and Party A scores. There are 5 values (2, 10, 1, 14, 3) of party a lower than Party B's 15, but there are only 3 values (2, 1, 3) less than or equal to r = 8, so Party A gets 3 points.
The total score of example 1 was 3:1, and that of example 2 was 11:3.
[data limit] for 70% of the data, both parties will not abstain, and the game will be held for 10 rounds.
100% of the data, each curling distance from the target point P is not more than 100< br>





answer:If there is no answer, please comment