当前位置:网站首页>PTA 1046 stroke (15 points)
PTA 1046 stroke (15 points)
2022-06-24 05:10:00 【freesan44】
subject
Boxing is an interesting part of the ancient Chinese wine culture . The method of two people on the wine table is : Shout out a number from each mouth , Draw a number with your hand . If someone's number is exactly equal to the sum of the two Numbers , Whoever wins , The loser gets a glass of wine . Either a win or a loss goes on to the next round , Until the only winner comes along .
So let's give you a 、 The record of two people's rowing , Please count how many glasses of wine they drank at last .
Input format :
Enter the first line to give a positive integer first N(≤100), And then N That's ok , Each line gives a record of one stroke , The format is :
A shout A stroke Ethyl shout B row
Among them, shouting is the number , A stroke is a number drawn out , No more than 100 The positive integer ( Row with both hands ).
Output format :
Output a in a row 、 B. the number of glasses they drink , Separated by a space .
sample input : 5 8 10 9 12 5 10 5 10 3 8 5 12 12 18 1 13 4 16 12 15 No blank lines at the end sample output : 1 2 No blank lines at the end
Their thinking
inputRound = int(input())
# inputRound = 5
aWin = 0
bWin = 0
for i in range(inputRound):
aH,aNum,bH,bNum = map(int, input().split())
# aH, aNum, bH, bNum = map(int, "3 8 5 12".split())
if aNum != bNum:
if aNum == (aH + bH):
aWin += 1
elif bNum == (aH + bH):
bWin += 1
print(str(bWin)+ " " + str(aWin))边栏推荐
- 解析后人类时代类人机器人的优越性
- What is an ECS? ECS、BCC、CVM...
- Customer disaster recovery case - a MySQL database migration scheme
- How the query address of cloud native monitoring data exposes the public network
- Why do hybrid clouds exist?
- Hard core JS: there may be a memory leak in your program
- 查找GBase 8c数据库当前索引?
- Let children learn the application essence of steam Education
- Svg quick start small white article
- Implementation principle of Flink connector mongodb CDC
猜你喜欢

Zhang Xiaodan, chief architect of Alibaba cloud hybrid cloud: evolution and development of government enterprise hybrid cloud technology architecture
![[leetcode daily question] push domino](/img/81/1c31e97d9a245816514bcf47c92107.jpg)
[leetcode daily question] push domino

Analysis on the subjective enthusiasm of post-90s makers' Education

少儿编程课程改革后的培养方式

Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players

Leetcode question brushing (question 3) - the longest substring without repeated characters

解析后人类时代类人机器人的优越性

让孩子们学习Steam 教育的应用精髓

Leetcode (question 1) - sum of two numbers

『渗透基础』Cobalt Strike基础使用入门_Cobalt Strike联动msfconsole
随机推荐
Bi-sql and & or & in
What is the implementation of domain name to IP address conversion? What are the benefits of switching to a website?
What is stored in the domain name server? How does the domain name server provide services?
Hard core JS: there may be a memory leak in your program
Locating memory leaks with poolmon
What domain name does not need to be filed? What should be done for domain name filing
What is the secondary domain name of the website? What is the relationship between the secondary domain name and the primary domain name?
Functional advantages of industrial wireless router
Why domain name should be resolved? What is the domain name registration query
LeetCode 1290. Binary linked list to integer
Redis pipeline technology speed and efficiency increased by 5 times
LeetCode 1791. Find the central node of the star chart
How the query address of cloud native monitoring data exposes the public network
Introduction to ebpf
让孩子们学习Steam 教育的应用精髓
Is there a free ECS? What should I pay attention to when I rent a server
System design: Agent & redundancy & replication
NLP baked gluten
Advantages of fixed assets management system
What are the disadvantages of the free IP address replacement tool?