安徽做网站公司哪家好,什么是推广员,四网合一的网站,网站首页效果图怎么做Array Division 题意#xff1a;给一个序列#xff0c;问将一个数调换顺序能否使得序列分为连续的2段后#xff0c;2段的和相同#xff1b; 思路#xff1a;模拟#xff0c;注意一点#xff0c;可能第一个数就大于sum/2#xff0c;所以要1-n模拟一遍再n-1模拟一遍…Array Division 题意给一个序列问将一个数调换顺序能否使得序列分为连续的2段后2段的和相同 思路模拟注意一点可能第一个数就大于sum/2所以要1-n模拟一遍再n-1模拟一遍具体看代码 AC代码 #include iostream
#include iomanip
#include string.h
#include stack
#include queue
#include string
#include vector
#include set
#include map
#include algorithm
#include stdio.h
#include math.h
#pragma comment(linker, /STACK:102400000,102400000)
#define bug(x) coutx UUUUUendl;
#define mem(a,x) memset(a,x,sizeof(a))
#define step(x) fixed setprecision(x)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define ll long long
#define endl (\n)
#define ft first
#define sd second
#define lrt (rt1)
#define rrt (rt1|1)
using namespace std;
const ll mod1e97;
const ll INF 1e181LL;
const int inf 1e91e8;
const double PIacos(-1.0);
const int N1e5100;ll n,a[N],sum,now;
mapll,int M1,M2;
int main(){scanf(%lld,n);for(int i1; in; i){scanf(%lld,ai);suma[i], M1[a[i]], M2[a[i]];}if(sum1){coutNO\n;return 0;}for(int i1; in; i){ll x(sum/2)-now;if(M1[x]0){coutYES\n;return 0;}nowa[i], M1[a[i]]--;}now0;for(int in; i1; --i){ll x(sum/2)-now;if(M2[x]0){coutYES\n;return 0;}nowa[i], M2[a[i]]--;}coutNO\n;return 0;
} 转载于:https://www.cnblogs.com/max88888888/p/7638070.html