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语言 C++
PAT (Basic Level) Practice (中文)1099 性感素数(20分)
“性感素数”是指形如 (p, p+6) 这样的一对素数。之所以叫这个名字,是因为拉丁语管“六”叫“sex”(即英语的“性感”)。(原文摘自 http://mathworld.wolfram.com/SexyPrimes.html) 现给定一个整数,请你判断其是否为一个性感素数。
170 0
|
测试技术
PAT (Basic Level) Practice (中文) B1011 A+B 和 C (15 分)
PAT (Basic Level) Practice (中文) B1011 A+B 和 C (15 分)
116 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 分)
94 0
|
存储 测试技术
PAT (Basic Level) Practice (中文) 1004 成绩排名 (20 分)
PAT (Basic Level) Practice (中文) 1004 成绩排名 (20 分)
97 0
|
C语言
PAT (Basic Level) Practice (中文) B1026 程序运行时间 (15 分)
PAT (Basic Level) Practice (中文) B1026 程序运行时间 (15 分)
127 0
|
算法
PAT (Basic Level) Practice (中文)1028. 人口普查(20分)
PAT (Basic Level) Practice (中文)1028. 人口普查(20分)
113 0
PAT (Basic Level) Practice (中文) 1036 跟奥巴马一起编程 (15 分) p89
PAT (Basic Level) Practice (中文) 1036 跟奥巴马一起编程 (15 分) p89
169 0
|
机器学习/深度学习 测试技术 Python
PAT (Basic Level) Practice (中文)第1002题
PAT (Basic Level) Practice (中文)第1002题
124 0
PAT (Basic Level) Practice (中文)- 1060 爱丁顿数(25 分)
PAT (Basic Level) Practice (中文)- 1060 爱丁顿数(25 分)
108 0
PAT (Advanced Level) Practice - 1055 The World‘s Richest(25 分)
PAT (Advanced Level) Practice - 1055 The World‘s Richest(25 分)
119 0