Codeforces 18C Solution
Solve in C++:
- ///**********ALLAH IS ALMIGHTY************///
- ///AH Tonmoy
- ///Department of CSE
- ///Islamic University,Bangladesh
- #include<iostream>
- #include<math.h>
- #include<algorithm>
- using namespace std;
- int main()
- {
- int n,i,a[100009],s1=0,s=0,r=0,div,c=0;
- cin>>n;s=0;
- for(i=0; i<n; i++)
- { cin>>a[i];
- s=s+a[i];
- }
- if(s%2==1)
- { cout<<"0"<<endl;
- return 0;
- }
- else
- {
- for(i=0; i<n-1; i++)
- { s1+=a[i];
- s-=a[i];
- if(s1==s)
- r++;
- }
- cout<<r<<endl;
- return 0;
- }
- }
No comments