Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int t;
- cin>>t;
- while(t--)
- {
- int n, m;
- cin>>n>>m;
- vector<int> a(n);
- for(auto &e: a) cin>>e;
- int tot = 0;
- int ans = 0;
- for(auto e: a){
- tot += e;
- if(tot >= m){
- ans++;
- tot = 0;
- }
- }
- cout<<ans<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement