Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
那位蝈蝈帮忙看一下,怎么就wa了呢#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator