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

发生成数据程序涨Rp~~~

Posted by msls at 2014-01-19 01:40:37 on Problem 1815
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
const int Limit = 200;
int main()
{
	srand((time(NULL) + rand() + 6777)% rand());
	srand(((rand() + rand()) % 1234 + rand()) % 5678);
	int n = rand() % Limit + 1;
	while(n <= 1)
	{
		n = rand() % Limit + 1;
	}
	int G[201][201];
	int i,j;
	memset(G , 0 , sizeof(G));
	printf("%d ",n);
	int a = rand() % n + 1 , b = rand() % n + 1;
	while(a == b)
	{
		a = rand() % n + 1;
		b = rand() % n + 1;
	}
	printf("%d %d\n",a,b);
	for(i = 1 ; i <= n ; ++i)
	for(j = i + 1 ; j <= n ; ++j)
	{
		srand((rand() + rand()) % 143);
		G[i][j] = rand() % 2;
	}
	for(i = 2 ; i <= n ; ++i)
	for(j = 1 ; j < i ; ++j)
	    G[i][j] = G[j][i];
	for(i = 1 ; i <= n ; ++i)
	{
		for(j = 1 ; j <= n ; ++j)
			printf("%d ",G[i][j]);
		puts("");
	}
	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