标签:name oid sof ring and ack code res namespace
输入样例:
5
8 10 9 12
5 10 5 10
3 8 5 12
12 18 1 13
4 16 12 15
输出样例:
1 2
思路是建立一张表,储存划拳的信息,一个一个地去比较统计。
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
struct ImformationOfAandB
{
int guessOfA,guessOfB;
int resultOfA,resultOfB;
};
void count(ImformationOfAandB* p,int n);
int main()
{
int n;
cin>>n;
ImformationOfAandB* p=new ImformationOfAandB[n];
for(int i=0;i<n;i++)
cin>>p[i].guessOfA>>p[i].resultOfA>>p[i].guessOfB>>p[i].resultOfB;
count(p,n);
delete p;
return 0;
}
void count(ImformationOfAandB* p,int n)
{
int countOfA=0,countOfB=0;
for(int i=0;i<n;i++)
{
if(p[i].resultOfA==p[i].guessOfA+p[i].guessOfB && p[i].resultOfB!=p[i].guessOfA+p[i].guessOfB)
countOfA++;
else
{
if(p[i].resultOfA!=p[i].guessOfA+p[i].guessOfB && p[i].resultOfB==p[i].guessOfA+p[i].guessOfB)
countOfB++;
}
}
cout<<countOfB<<" "<<countOfA;
}
标签:name oid sof ring and ack code res namespace
原文地址:https://www.cnblogs.com/FDProcess/p/9245746.html