求助,10个WA,谢谢大佬

P2356 弹珠游戏

[甚至在昨天就AC了](https://www.luogu.com.cn/record/111309942)
by Archer1blossom @ 2023-05-27 09:15:45


@[Archer1blossom](/user/1004328) 今天我不理解哪里错了
by LGDccc @ 2023-05-27 09:19:31


@[aaa444](/user/770005) 不能和敌人在一个地方(关注)
by codejiahui @ 2023-05-27 09:26:06


@[codejiahui](/user/512407) 你几个意思
by LGDccc @ 2023-05-27 09:48:19


@[aaa444](/user/770005) ?
by codejiahui @ 2023-05-27 09:51:39


@[codejiahui](/user/512407) 为什么要加个括号
by LGDccc @ 2023-05-27 09:52:49


@[codejiahui](/user/512407) 我不是已经关注了吗?
by LGDccc @ 2023-05-27 10:04:03


``` #include <bits/stdc++.h> using namespace std; int a[1001][1001], n; int f(int, int); int main(){ cin >> n; for(int i = 1; i <= n; i ++) for(int j = 1; j <= n; j ++) cin >> a[i][j]; int ans = -1; for(int i = 1; i <= n; i ++) for(int j = 1; j <= n; j ++) if(!a[i][j]) ans = max(ans, f(i, j)); if(ans == -1) cout << "Bad Game!"; else cout << ans; return 0; } int f(int x, int y){ int sum = 0; for(int i = 1; i <= n; i ++) sum += a[x][i] + a[i][y]; return sum; } ``` 本蒟蒻的看法(求关注)
by Archer1blossom @ 2023-05-27 13:10:37


``` #include<bits/stdc++.h> using namespace std; int a[10005][10005]; int sumi[10005],sumj[10005],sum; int main(){ int n; cin>>n; for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { cin>>a[i][j]; sumi[i]+=a[i][j]; sumj[j]+=a[i][j]; } } sum=-1; for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++){ if(sum<sumi[i]+sumj[j]&&a[i][j]==0) { sum=sumi[i]+sumj[j]; } } } cout<<sum; return 0; } ```
by qusia_MC @ 2023-12-26 19:53:46


~~我是蒟蒻~~ 这个题你用前缀和做是对的,但是你没有考虑 1. 需要考虑[i,j]是不是容身之地 1. 需要在容身之地的基础上求最大值 1. a[10005][10005]是读入的数子,定义为布尔行肯定不对 1. ~~最后-2是什么意思,本蒟蒻看不懂~~提醒,凡是最后输出有一个-1,+2这样的数字加减,一般都是为了样例过而凑得数,大部分不会对
by qusia_MC @ 2023-12-26 19:58:47


| 下一页