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 peijian at 2011-03-24 20:30:33 on Problem 2328
#include<iostream>
#include<vector>
using  namespace  std;
template <typename T>
bool f(vector<T> high, vector<T > low,int n)
{
	int i,j;
	for( i=0;i!=high.size();i++)
	{
		for( j=0;j!=low.size();j++)
			if(high[i]<=low[i]||low[j]>=n||high[i]<=n)
				return false ;
	}
	return  true;
}
int main()
{
    vector<int >high,low;
	int n;
	char a[6],b[6];
	while(cin>>n&&n!=0)
	{
		cin>>a>>b;
		if(b[0]=='h')
			high.push_back(n);
		if(b[0]=='l')
			low.push_back(n);
		if(a[0]=='r')
		{
			if(f(high,low,n))
			{
				cout<<"Stan may be honest"<<endl;
			}
			else
			{
				cout<<"Stan is dishonest"<<endl;
			}
			high.clear();low.clear();

		}
	}
	
	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