Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么RE啊~~~谢谢啦

Posted by trueshlqsh at 2008-01-06 16:58:52 on Problem 1013
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;

long t;
long _real[13],pd[13];
string st1,st2,st3;
long ans;

int main()
{
    cin>>t;
    for (long i=1;i<=t;i++)
    {
        for (long j=1;j<=12;j++) {_real[i]=0;pd[i]=0;}
        for (long r=1;r<=3;r++)
        {
        cin>>st1>>st2>>st3;
        if (st3=="even") for (long k=0;k<=3;k++) _real[st1[k]-64]=_real[st2[k]-64]=1;
          else if (st3=="up") for (long k=0;k<=3;k++) {pd[st1[k]-64]--;pd[st2[k]-64]++;}
            else for (long k=0;k<=3;k++) {pd[st1[k]-64]++;pd[st2[k]-64]--;}
        }
        for (long j=1;j<=12;j++)
        if (_real[j]==1) pd[j]=0;
        ans = 1;
        for (long j=2;j<=12;j++)
        if (fabs(pd[j])>fabs(pd[ans])) ans=j;
        cout<<char(ans+64)<<" is the counterfeit coin and it is ";
        if (pd[ans]>0) cout<<"light."<<endl;
                 else  cout<<"heavy."<<endl;
    }   
    return 0;

}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator