#abc187d. D - Choose Me
D - Choose Me
Score : points
问题陈述
AtCoder 城市将举行市长选举。候选人是青木和高桥。 该城市由 个城镇组成,第 个城镇有 名支持青木的选民和 名支持高桥的选民。没有其他选民。 高桥可以在每个城镇发表演讲。 如果他在某个城镇发表演讲,那么该城镇的所有选民,无论是支持高桥还是青木,都会投票给高桥。 另一方面,如果他不在某个城镇发表演讲,那么该城镇支持青木的选民将投票给青木,而支持高桥的选民将不会投票。 为了获得比青木更多的选票,高桥至少需要在多少个城镇发表演讲?
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
AtCoder City will hold a mayoral election. The candidates are Aoki and Takahashi.
The city consists of towns, the -th of which has pro-Aoki voters and pro-Takahashi voters. There are no other voters.
Takahashi can make a speech in each town.
If he makes a speech in some town, all voters in that town, pro-Takahashi or pro-Aoki, will vote for Takahashi.
On the other hand, if he does not make a speech in some town, the pro-Aoki voters in that town will vote for Aoki, and the pro-Takahashi voters will not vote.
To get more votes than Aoki, in how many towns does Takahashi need to make speeches at least?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4
2 1
2 2
5 1
1 3
Sample Output 1
1
After making a speech in the third town, Aoki and Takahashi will get and votes, respectively.
Sample Input 2
5
2 1
2 1
2 1
2 1
2 1
Sample Output 2
3
After making speeches in three towns, Aoki and Takahashi will get and votes, respectively.
Sample Input 3
1
273 691
Sample Output 3
1