⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gen.cpp

📁 PASCAL光盘资料PASCAL光盘资料PASCAL光盘资料
💻 CPP
字号:
#include <fstream>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <time.h>

using namespace std;

const int MAX = 30;

int n;
int w[MAX], l[MAX];
int a[MAX][MAX];

main() {
	srand(time(0));
	
	cin >> n;
	cout << n << endl;
	
	int i, j;
	for (i = 0; i < n; i++) {
		w[i] = rand()%100;
		l[i] = rand()%100;
	}
	
	for (i = 0; i < n; i++)
		for (j = 0; j < n; j++) 
			if (i == j) a[i][j] = 0;
			else if (i > j) a[i][j] = a[j][i];
			else a[i][j] = rand()%10;
			
	for (i = 0; i < n; i++)
		cout << w[i] << ' ' << l[i] << ' ';
	cout << endl;
	
	for (i = 0; i < n; i++)
		for (j = 0; j < n; j++)
			cout << a[i][j] << ' ';
	cout << endl;
	
	return 0;	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -