Codeforces Round 515

编程入门 行业动态 更新时间:2024-10-24 10:16:17

<a href=https://www.elefans.com/category/jswz/34/1770097.html style=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

本文发布于:2023-12-03 17:03:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1656880.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Codeforces

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!