Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Birthday Chocolate
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, s[1000], d, m, sum=0, ats=0;
- cin >> n;
- for(int i=0;i<n;i++)
- {
- cin >> s[i];
- }
- cin >> d >> m;
- for(int y=0;y<n;y++)
- {
- sum=0;
- sum+=s[y];
- for(int j=y+1;j<m;j++)
- {
- sum+=s[j];
- }
- m++;
- if(sum==d)
- {
- ats++;
- }
- }
- cout << ats << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment