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 uljfwffj1 at 2010-07-30 02:47:47 on Problem 1656
#include<iostream>
using namespace std;
int main()
{
	int n , f , s , t , j , temp , tem , sum;
	int state[101][101] = {0} , change;
	char com[8];
	while(n --)
	{
		cin >> com >> f >> s >> t;
		if((com[0] == 'B' && change = 1) || (com[0] == 'W' && change = 0))
		{
			j = (f + t > 100) ? 100 - f : t;
			t = (s + t > 100) ? 100 - s : t;
			for(temp = 0; temp < j ; temp++)
				for(tem = 0 ; tem < t ; tem ++)
					state[f + temp][s + tem] = change;
		}
		else if(com[0] == 'T')
		{
			j = (f + t > 100) ? 100 - f : t;
			t = (s + t > 100) ? 100 - s : t;
			for(temp = sum = 0; temp < j ; temp++)
				for(tem = 0 ; tem < t ; tem ++)
					if(state[f + temp][s + tem])
						sum++;
			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