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

帮我看看,哪儿错了!

Posted by 0705020329 at 2008-10-06 22:11:45 on Problem 3425
#include<iostream>
using namespace std;
int findx(int *a,int n,int q)
{
   for(int i=0;i<n;i++)
     if(a[i]==q)
        return 1;
   return 0;     
}
int main()
{
     int n,counta=0;
     int a, q[10001],x ,sum=0,temp=0;
     int tep=0;
    scanf("%d",&n);
      for( int i=0;i<n;i++)
     {
        cin>>q[i]>>a>>x;
        if(a==0)
            sum+=10;
        if(i>=1)
          tep=findx(q,i,q[i]);
        if(i<1)
        {
          if(a==1&&x==0)
             sum+=20;
          if(a==1&& x==1 )
              sum+=40;
        }
       if(tep==1&&i>=1)
        {
             if(a==1&&x==0&&counta==0)
               sum+=20;
             if(a==1&&x==0&&counta>0)
               sum+=30;
             if(a==1&& x==1 &&counta==0)
              sum+=40;
             if(a==1 && x==1&& counta>0)
              sum+=50;
            
        }
        if(tep==0&&i>=1)
        {
             counta=0;
             if(a==1&&x==0)
               sum+=20;
             if(a==1&& x==1 )
                sum+=40;
        }
        if(a==1)
          counta+=1;
    }
    cout<<sum<<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