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

这题.....谁帮我看一下,不知wa在哪

Posted by fjnu_jxd_010 at 2005-10-07 14:52:08 on Problem 2632
#include <iostream>
using namespace std;

const int S=800;

int main()
{
	int j,k,cn,cnn,ci,i,n,xn,yn,o,v;
	int f[S],x[S],y[S],out;
	int mx[14]={1,0,-1,0},my[14]={0,1,0,-1};
	char ch,c;
	cin>>cnn;
	for (ci=0;ci<cnn;ci++)
	{
		cin>>xn>>yn>>n>>cn;
		for (i=1;i<=n;i++)
		{
			cin>>x[i]>>y[i]>>ch;
			if (ch=='E')
				f[i]=0;
			else if (ch=='N')
				f[i]=1;
			else if (ch=='W')
				f[i]=2;
			else if (ch=='S')
				f[i]=3;
		}
		for (out=0,i=1;i<=cn;i++)
		{
			cin>>o>>c>>v;
			if (c=='F')
			{
				for (k=1;k<=v;k++)
				{
					x[o]+=mx[f[o]];
					y[o]+=my[f[o]];
					for (j=1;j<=n;j++)
						if (o!=j&&x[o]==x[j]&&y[o]==y[j])
						{
							cout<<"Robot "<<o<<" crashes into robot "<<j<<endl;
							out=1;
							break;
						}
					if (out)
						break;
					if (x[o]<=0||x[o]>xn||y[o]<=0||y[o]>yn)
					{
						cout<<"Robot "<<o<<" crashes into the wall\n";
						out=1;
						break;
					}
				}
			}
			else
			{
				v%=4;
				if (c=='L')
					f[o]=(f[o]+v)%4;
				else
					f[o]=(f[o]+4-v)%4;
			}
		}
		for (++i;i<=cn;i++)
			cin>>o>>c>>v;
		if (!out)
			cout<<"OK\n";
	}
	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