| ||||||||||
| 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 | |||||||||
设计的多巧的代码呵,尤其那个条件,就是编译报错。改成正常的条件的对了#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator