Codeforces Round 515"/>
Codeforces Round 515
Portal.
C. Books Queries
Portal.
sol.
D. Boxes Packing
Portal.
把从左至右删物品转化为从右至左加物品。模拟即可。
#include <bits/stdc++.h>
using namespace std;const int maxn=2e5+5;
int a[maxn];int main()
{int n,m,k;cin>>n>>m>>k;for(int i=1;i<=n;i++) cin>>a[i];int cnt=m,res=0;for(int i=n;i;i--){if(res+a[i]<=k) res+=a[i];else cnt--,res=a[i];if(!cnt) cout<<(n-i),exit(0); }cout<<n;return 0;
}
F. Yet another 2D Walking
Portal.
sol.
更多推荐
Codeforces Round 515
发布评论