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 litble at 2017-09-27 18:53:04 on Problem 3592
此题坑点:
如果被传送到了墙上,是不能前进了的。
如果(0,0)位置是墙,依然是能前进的。
也就是说墙不能添加入边但是需要添加出边
数据生成器(生成小数据,有利于裸眼观察查错,如果需要大数据,改一改数据范围即可):
#include<cstdio>
#include<cstdlib>
#include<ctime>
using namespace std;
int n,m,x,y,T;
int main()
{
	int i,j;
	srand(time(NULL));
	T=rand()%10+1;
	printf("%d\n\n",T);
	while(T--){
		int k=0;
		n=rand()%10+1,m=rand()%10+1;
		printf("%d %d\n",n,m);
		for(i=0;i<n;++i){
			for(j=0;j<m;++j){
			x=rand()%11;
			if(!x)printf("#");
			else if(x==10)printf("*"),++k;
			else printf("%d",x);
			}
			printf("\n");
		}
		for(i=1;i<=k;++i)x=rand()%n,y=rand()%m,printf("%d %d\n",x,y);
		printf("\n");
	}
    return 0;
}
QAQ调了我一晚上才知道是这坑爹问题。

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