PAT (Basic Level) Practice (中文) B1046 划拳 (15 分)

简介: PAT (Basic Level) Practice (中文) B1046 划拳 (15 分)

题目描述:

#include<bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a1,a2,b1,b2; 
  int afalse=0,bfalse=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++)
  {
    scanf("%d %d %d %d",&a1,&a2,&b1,&b2);
    if(a1+b1==a2&&a1+b1==b2)
    {
      continue;
    } 
    if(a1+b1==a2)
    {
      bfalse++;
    }
    if(a1+b1==b2)
    {
      afalse++;
    }
  }
  printf("%d %d",afalse,bfalse);
} 

注:

要注意两者全猜情况下可以直接跳出循环,不计数

参考答案给出的判断条件

if(a1+b1==a2&&a1+b1!=b2)
相关文章
|
C语言
PAT (Basic Level) Practice (中文) B1026 程序运行时间 (15 分)
PAT (Basic Level) Practice (中文) B1026 程序运行时间 (15 分)
96 0
|
测试技术
PAT (Basic Level) Practice (中文) B1011 A+B 和 C (15 分)
PAT (Basic Level) Practice (中文) B1011 A+B 和 C (15 分)
76 0
PAT (Basic Level) Practice (中文) B1011 A+B 和 C (15 分)
PAT (Basic Level) Practice (中文) 1016 部分A+B (15 分)
PAT (Basic Level) Practice (中文) 1016 部分A+B (15 分)
64 0
|
存储 测试技术
PAT (Basic Level) Practice (中文) 1004 成绩排名 (20 分)
PAT (Basic Level) Practice (中文) 1004 成绩排名 (20 分)
63 0
|
算法
PAT (Basic Level) Practice (中文)1028. 人口普查(20分)
PAT (Basic Level) Practice (中文)1028. 人口普查(20分)
76 0
PAT (Basic Level) Practice (中文) 1036 跟奥巴马一起编程 (15 分) p89
PAT (Basic Level) Practice (中文) 1036 跟奥巴马一起编程 (15 分) p89
125 0
|
机器学习/深度学习 测试技术 Python
PAT (Basic Level) Practice (中文)第1002题
PAT (Basic Level) Practice (中文)第1002题
88 0
PAT (Basic Level) Practice (中文)- 1060 爱丁顿数(25 分)
PAT (Basic Level) Practice (中文)- 1060 爱丁顿数(25 分)
78 0
PAT (Basic Level) Practice (中文)- 1050 螺旋矩阵(25 分)
PAT (Basic Level) Practice (中文)- 1050 螺旋矩阵(25 分)
79 0
|
存储
PAT (Advanced Level) Practice - 1126 Eulerian Path(25 分)
PAT (Advanced Level) Practice - 1126 Eulerian Path(25 分)
113 0