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

那位蝈蝈帮忙看一下,怎么就wa了呢

Posted by zhuhaiwen at 2009-04-29 00:15:20 on Problem 2460
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main()
{
    int n;
    int a1=0;
    int a2=0;
    vector< pair<int,int> > pvec;
    pair<int,int> temp;
    cin>>n;
    for(int i=0;i<n;++i)
    {
      int a,b;
      cin>>a>>b;
      temp=make_pair(a,b);
	  pvec.push_back(temp);
    }
    pair<int,int> mid=*(pvec.begin()+pvec.size()/2);
    int c=mid.first;
    int d=mid.second;
    for(vector< pair<int,int> >::iterator iter=pvec.begin();iter!=pvec.end();++iter)
    {
      if((iter->first)>c&&(iter->second)>d)
        ++a1;
      else if((iter->first)<c&&(iter->second)<d)
        ++a1;
      else if((iter->first)>c&&(iter->second)<d)
        ++a2;
      else if(((iter->first)<c)&&(iter->second)>d)
        ++a2;
    }
    cout<<a1<<" "<<a2;
    int flag;
    cin>>flag;
    if(flag==0)
      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