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 00448176 at 2005-03-13 22:01:55 on Problem 1013
#include<iostream.h>
void main(){
	char left[3][10],right[3][10],balance[3][10];
	int num;
	cin>>num;
	for(int k1=0;k1<num;k1++){
		for(int k2=0;k2<3;k2++){
			cin>>left[k2]>>right[k2]>>balance[k2];
		}
	

	for(int k3=0;k3<12;k3++){
		int goOn=1;
		int k5;
		int l=0,r=0;
		for(k5=0;k5<3;k5++){
			for(int k4=0;right[k5][k4]!='\0';k4++){
			if(right[k5][k4]==k3+'A')r=1;
			}
			for(k4=0;left[k5][k4]!='\0';k4++){
			if(left[k5][k4]==k3+'A')l=1;
			}
		

			if(goOn==0)break;
			switch(balance[k5][0]){
			case'u':
				if(r!=1)goOn=0;
				break;

			case'd':
				if(l!=1)goOn=0;
				break;
			case'e':
				if(l==1||r==1)goOn=0;
			}
			l=0;
			r=0;
		}

		if((k5==3)&&(goOn==1)){
			char tmp=k3+'A';
			cout<<tmp<<" is the counterfeit coin and it is heavy.\n";
		}
	
		
	}
	for(k3=0;k3<15;k3++){
		int goOn=1;
		int l=0,r=0;
		for(int k5=0;k5<3;k5++){
			for(int k4=0;right[k5][k4]!='\0';k4++){
			if(right[k5][k4]==k3+'A')r=1;
			}
			for(k4=0;left[k5][k4]!='\0';k4++){
			if(left[k5][k4]==k3+'A')l=1;
			}
		

			if(goOn==0)break;
			switch(balance[k5][0]){
			case'd':
				if(r!=1)goOn=0;
				break;

			case'u':
				if(l!=1)goOn=0;
				break;
			case'e':
				if(l==1||r==1)goOn=0;
			}
			l=r=0;
		}
	
		if((k5==3)&&(goOn==1)){
			char tmp=k3+'A';
			cout<<tmp<<" is the counterfeit coin and it is light.\n";
		}
	
		
	}}
}

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