Football (aka Soccer) UVA - 10194 足球 wa

/*   跪求好心人哪里错了,555555,已经wa好几个小时了,求求好心人帮助    */

//提交的时候我会把freopen注释掉的   现在还是 wa 的状态555555

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<sstream>
#include<cctype>
using namespace std;
struct _team
{
    int a,b,c,d,e,f,g,h,i;
    string team_name,ttemp;
    _team()
    {
        a=0;b=0;c=0;d=0;e=0;f=0;g=0;h=0;i=0;
        team_name="";
    }

}team[2000];

string tt[6];

void get(const string& t)
{
    //cout<<t<<endl;
    string temp=t;
    int i=0,flag=0,_flag=0;
    while(i<temp.length())
    {
        if(temp[i]=='#'||temp[i]=='@'){
            i++;flag++;continue;
        }//if
        tt[flag]=tt[flag]+temp[i];
        i++;
    }//cout<<"   "<<tt[1]<<"  "<<tt[2]<<endl;
  /* for(int i=0;i<4;i++)
        cout<<tt[i]<<"    ";
    cout<<endl; */
}
int cmp1(_team a,_team b)
{
    if(a.b!=b.b)
        return a.b>b.b;
    else if(a.d!=b.d)
        return a.d>b.d;
    else if(a.g!=b.g)
        return a.g>b.g;
    else if(a.h!=b.h)
        return a.h>b.h;
    else if(a.c!=b.c)
        return a.c<b.c;
    else
        return a.ttemp<b.ttemp;
}
int main()
{
   int _a,num,_flag=1,num1=0;freopen("input.txt","r",stdin);
   cin>>_a;num=_a;getchar();
   while(_a--)
   {    num1++;
       for(int i=0;i<1998;i++)
       {

           team[i].a=0;
           team[i].b=0;
           team[i].c=0;
           team[i].d=0;
           team[i].e=0;
           team[i].f=0;
           team[i].g=0;
           team[i].h=0;
           team[i].i=0;
           team[i].team_name="";
           team[i].ttemp="";
       }
       string a;
       getline(cin,a);
       cout<<a<<endl;
       int _b;
       cin>>_b;getchar();
       //string b[_b];
       for(int i=0;i<_b;i++)
       {
           getline(cin,team[i].team_name);
           string ss;
           for(int w=0;w<team[i].team_name.length();w++)
               {
                   if(isupper(team[i].team_name[w]))
                    {ss=tolower(team[i].team_name[w]);
                    team[i].ttemp=team[i].ttemp+ss;}
                    else   team[i].ttemp=team[i].ttemp+team[i].team_name[w];
                }
           // cout<<team[i].ttemp<<endl;
       }
       int _c;
       cin>>_c;getchar();
       string c[_c],cc;
       for(int i=0;i<_c;i++)
       {
           getline(cin,cc);//cout<<"cc="<<cc<<endl;
           get(cc);
           int tt1,tt2;          // cout<<"   "<<tt[1]<<"  "<<tt[2]<<endl;
           stringstream stream1(tt[1]);
           stream1>>tt1;
           stringstream stream2(tt[2]);
           stream2>>tt2;

           //cout<<tt1<<"   "<<tt2<<endl;
           for(int j=0;j<_b;j++){
                if(team[j].team_name==tt[0]){
                    if(tt[1]>tt[2]) {team[j].b=team[j].b+3;team[j].d=team[j].d+1;}
                    else if(tt[1]==tt[2]) {team[j].b=team[j].b+1;team[j].e=team[j].e+1;}
                    else if(tt[1]<tt[2]) {team[j].b=team[j].b+0;team[j].f=team[j].f+1;}
                    team[j].c=team[j].c+1;
                    team[j].h=team[j].h+tt1;
                    team[j].i=team[j].i+tt2;
                    team[j].g=team[j].h-team[j].i;
                }//if tt[0]
                if(team[j].team_name==tt[3]){
                    if(tt[1]<tt[2]) {team[j].b=team[j].b+3;team[j].d=team[j].d+1;}
                    else if(tt[1]==tt[2]) {team[j].b=team[j].b+1;team[j].e=team[j].e+1;}
                    else if(tt[1]>tt[2]) {team[j].b=team[j].b+0;team[j].f=team[j].f+1;}
                    team[j].c=team[j].c+1;
                    team[j].h=team[j].h+tt2;
                    team[j].i=team[j].i+tt1;
                    team[j].g=team[j].h-team[j].i;
                }//if  tt[3]
           }//for j
            for(int i=0;i<4;i++)
                tt[i]="";
         }
         //if(_flag){cout<<"\n";_flag=0;}
         sort(team,team+_b,cmp1);

         for(int i=0;i<_b;i++)
            cout<<i+1<<") "<<team[i].team_name<<" "<<team[i].b<<"p, "<<team[i].c<<"g ("<<team[i].d<<"-"<<team[i].e<<"-"<<team[i].f<<"), "<<team[i].g<<"gd ("<<team[i].h<<"-"<<team[i].i<<")\n";
        if(num!=num1)cout<<"\n";
   }//while
}

 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值