http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1057
做题的时候一定要看清题意,提交之前一定要再 看一遍样例输出的格式。
就是这样的一句话
where the value of a and b are for you to determine. A blank line should separate output lines.
有多少人WA了!!!!!
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define inf 999999999
using namespace std;
int a[100],b[100];
int main()
{
//freopen("2.txt","w",stdout);
int n,count = 0;
while(cin>>n && n)
{
if(count) cout<<endl;/*输出空行*/
count++;
int i,j,scorea = 0, scoreb = 0;
for(i = 0; i < n; i++)
cin>>a[i];
for(i = 0; i < n; i++)
{
cin>>b[i];
if(a[i] + b[i] == 3)
{
if(a[i]>b[i]) scoreb += 6;
else scorea += 6;
}
else if(abs(a[i] - b[i]) == 1)
{
if(a[i] > b[i]) scoreb += (a[i] + b[i]);
else
scorea += (a[i] + b[i]);
}
else if(a[i] == b[i]) continue;
else
{
//if(i == 0) cout<<a[i]<<"********"<<b[i]<<endl;
if(a[i] > b[i]) scorea += a[i];//,cout<<a[i]<<"**"<<scorea + a[i]<<endl;
else
scoreb += b[i];
}
}
cout<<"A has "<<scorea<<" points."<<" B has "<<scoreb<<" points."<<endl;
//cout<<endl;
}
return 0;
}