呜呜呜
2026-03-21 08:13:37
发布于:广东
39阅读
0回复
0点赞
大佬谁会?
全部评论 2
- 置顶
#include <iostream>
#include <vector>using namespace std;
bool judgeBalanceArray(int n, vector<int> a) {
for (int i = 1; i < n; i++) {
int firstToI = 0, iPlus1ToN = 0;
for (int j = 0; j < i; j++) {
firstToI += a[j];
}
for (int j = i; j < n; j++) {
iPlus1ToN += a[j];
}
if (firstToI == iPlus1ToN) {
return true;
}
}
return false;
}
int main() {
int t;
cin >> t;for (int i = 0; i < t; i++) { int size; cin >> size; vector<int> v(size); for (int i = 0; i < size; i++) { cin >> v[i]; } if (judgeBalanceArray(size, v)) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0;}
2026-03-31 来自 浙江
1感谢
2026-05-08 来自 广东
0?你这是 ctj 吗,直接去题解抄不就行了还要抄这个 AI 的代码
2026-05-28 来自 浙江
0
#include <bits/stdc++.h> using namespace std; bool f=true; int main() { int t; cin>>t; for(int i=0;i<t;i++) { int n; cin>>n; int a[10005]; for(int j=0;j<n;j++) { cin>>a[j]; } for(int j=0;j<n;j++) { int h=0; int h2=0; f=false; for(int k=0;k<j;k++) { h=h+a[k]; } for(int k=j;k<n;k++) { h2=h2+a[k]; } if(h==h2) { f=true; cout<<"Yes"<<endl; break; } } if(f==false)cout<<"No"<<endl; } return 0; }洛谷不行
2026-05-27 来自 浙江
0













有帮助,赞一个