只有第一个点不对,求助犇神们
  • 板块P2356 弹珠游戏
  • 楼主_O__o_
  • 当前回复3
  • 已保存回复3
  • 发布时间2022/12/15 21:10
  • 上次更新2023/10/24 07:35:47
查看原帖
只有第一个点不对,求助犇神们
741120
_O__o_楼主2022/12/15 21:10
#include<bits/stdc++.h>

using namespace std;
typedef long long ll ;
typedef int ii ;
typedef char cc ;
typedef double dd ;
typedef bool bb ;
int mapp[10001][10001];
int a[1001];
int _a[1001];
int n;
int h(int x,int y){
	int sum = 0;
	for(int i = n;i > x;i--)
		sum += mapp[i][y];
	for(int j = 0;j <= x;j++)
		sum += mapp[j][y];
	return sum;
}
int l(int x,int y){
	int sum = 0;
	for(int i = n;i > y;i--)
		sum += mapp[x][i];
	for(int j = 0;j <= y;j++)
		sum += mapp[x][j];
	return sum;
}
int main() {
	//step 1. 读题、声明变量	
	int aaa = 0;
	int sum = 0;
	int x = 0,y = 0;
	//step 2. 输入
	cin >> n;
	//step 3. 处理
	for(int i = 0;i < n;i++)
		for(int j = 0;j <n;j++){
			cin >> mapp[i][j];
			if(mapp[i,j] == 0){
				aaa += 1;
				x = i;
				y = j;
				a[aaa-1] = x;
				_a[aaa-1]= y;
			} }
	if(aaa != 0){
		cout <<"Bad Game!";
		return 0;
	} 
	//step 4. 输出
	for(int i = 0;i < aaa;i++)
		sum += max(h(a[i],_a[i]),l(a[i],_a[i]));
	cout << sum;
	return 0;
}




2022/12/15 21:10
加载中...