Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- bool kt=false;
- int sum=0,buff=0;
- void nhap(vector <int> &a)
- {
- int x;
- while (cin>>x)
- a.push_back(x);
- }
- void kiemtra(vector <int> &a)
- {
- for (int i=0; i<a.size();i++)
- sum+=a[i];
- for (int i=0; i<(a.size()-1);i++)
- {
- buff+=a[i];
- if(buff==sum/2)
- kt=true;
- }
- }
- void output()
- {
- if (kt==true)
- cout<<"True";
- else
- cout<<"False";
- }
- int main()
- {
- vector <int> a;
- nhap(a);
- kiemtra(a);
- output();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement