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

📄 2847156_tle.cpp

📁 北大大牛代码 1240道题的原代码 超级权威
💻 CPP
字号:
#include <stdio.h>
#include <algorithm>

int main()
{
	int n, mark[21];
	int map[21][21];
	int i, j, t, ans, tmp;

	scanf("%d",&n);
	ans = -1;
	for(i = 1; i <= n; i++)
		for(j = 1; j <= n; j++)
			scanf("%d",&map[i][j]);
	t = 1000000;
	while(t--)
	{
		tmp = 0;
		for(i = 1; i <= n; i++)
			mark[i] = (rand()%2+2)%2;
		for(i = 1; i <= n; i++)
		{
			if(mark[i])
			{
				for(j = 1; j <= n; j++)
					if(mark[j]==0)
						tmp += map[i][j];
			}
		}
		if(tmp > ans)
			ans = tmp;
	}
	printf("%d\n",ans);
	return 0;
}

⌨️ 快捷键说明

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