Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- int n, len[100002],soma=0,s=0,cont=0,ok=0,mar=-1,in=0;
- scanf("%d", &n);
- for(int i=0;i<n;i++){
- scanf("%d", &len[i]);
- soma=soma+len[i];
- }
- if(soma%2==1){
- printf("N\n");
- return 0;
- }
- int m=soma/2;
- int i=0,j=0;
- while(in<m){
- if(s<=m){
- s=s+len[j];
- j++;
- }
- else{
- s=s-len[i];
- in+=len[i];
- i++;
- }
- if(s==m){
- cont++;
- }
- }
- if(cont>=2) printf("Y\n");
- else printf("N\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement