#k1325. 特难

特难

Football

题意翻译

科学家正在研究足球比赛结果对球迷情绪的影响。他们有一个假设,平局的数量与球迷未来观看足球比赛的欲望之间存在相关性。

在足球比赛中,两队进行比赛。球队在整场比赛中都有进球。得分“ x:yx:y ”意味着我们观察到的球队打进了 xx 球,丢了 yy 球。如果 x=yx=y ,则比赛是平局。如果 x>yx>y ,则观察到的团队获胜,如果 x<yx<y ,则观察到的团队失败。

为了找出是否存在相关性,科学家们收集了低级别联赛球队的结果信息。他们发现的信息是球队的比赛次数(记为 nn )、这些比赛中的进球数(记为 aa )和这些比赛中失球数(记为bb)。

给定单个团队的信息。计算球队比赛中可能出现的最低平局数,输出包含最低平局数的比赛分数表。

第一行包含一个整数 nn ——球队的比赛次数( 1≤n≤1001n100 ). 第二行包含一个整数 aa ——球队在这 nn 场比赛中的进球总数( 0≤a≤10000a1000 ). 第三行包含一个整数 bb ——球队在这nn场比赛中失球的总数( 0≤b≤10000b1000 )。

在第一行中,输出一个整数dd——最低平局数。

在以下 nn 行中,输出分数列表,每行的格式为“ x:yx:y ”,其中 xx 是比赛中的进球数, yy 是失球数,因此这些比赛中的 dd 场比赛以平局结束。如果存在多个这样的分数列表,请输出其中任何一个。

翻译由@PCT2506提供

题目描述

Scientists are researching an impact of football match results on the mood of football fans. They have a hypothesis that there is a correlation between the number of draws and fans' desire to watch football matches in the future.

In football, two teams play a match. The teams score goals throughout a match. A score " xx : yy " means that the team we observe scored xx goals and conceded yy goals. If x=yx=y , then the match ends in a draw. If x>yx>y , then the observed team wins, and if x<yx<y , then it loses.

To find out if there is a correlation, the scientists gathered information about the results of teams in lower leagues. The information they found is the number of matches played by the team ( nn ), the number of goals scored in these matches ( aa ), and the number of goals conceded in these matches ( bb ).

You are given this information for a single team. You are asked to calculate the minimum number of draws that could have happened during the team's matches and provide a list of match scores with the minimum number of draws.

输入输出格式

输入格式

The first line contains an integer nn — the number of matches played by the team ( 1≤n≤1001n100 ). The second line contains an integer aa — the total number of goals scored by the team in all nn matches ( 0≤a≤10000a1000 ). The third line contains an integer bb — the total number of goals conceded by the team in all nn matches ( 0≤b≤10000b1000 ).

输出格式

In the first line, print a single integer dd — the minimum number of draws.

In the following nn lines, print a list of match scores, each line in the format " xx : yy ", where xx is the number of goals scored in the match, and yy – the number of goals conceded, so that exactly dd of these matches have ended in a draw. In case multiple such lists of match scores exist, print any of them.

输入输出样例

输入样例 #1

3
2
4

Copy

输出样例 #1

0
1:0
1:2
0:2

Copy

输入样例 #2

1
2
2

Copy

输出样例 #2

1
2:2

Copy

输入样例 #3

4
0
7

Copy

输出样例 #3

0
0:1
0:2
0:1
0:3

Copy

输入样例 #4

6
3
1

Copy

输出样例 #4

2
0:0
1:0
0:0
0:1
1:0
1:0

Copy

Football

Codeforces