ZOJ 1057 Undercut (格式问题)

来源:互联网 发布:一般淘宝代购是正品吗 编辑:程序博客网 时间:2024/06/05 04:33

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 999999999using 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;}


0 0
原创粉丝点击