
L2-1 包装机 (25 分)
发布日期:2021-05-07 07:25:14
浏览次数:25
分类:精选文章
本文共 589 字,大约阅读时间需要 1 分钟。
容器会的不多,但是就是个模拟
利用个erase(); 就行了。
#includeusing namespace std;int main() { int n,m,maax; string a[2000]; string c;//输出的 string d;//篮子 cin>>n>>m>>maax; for(int i=1; i<=n; i++) { cin>>a[i]; } int aa; while(1) { cin>>aa; if(aa==-1) break; else if(aa==0) { int l=d.size(); if(l==0) continue; c+=d.substr(l-1,1); d.erase(l-1,1); } else { if(a[aa].empty()) continue; if(d.size()==maax) { int l=d.size(); c+=d.substr(l-1,1); d.erase(l-1,1); d+=a[aa][0]; a[aa].erase(0,1); } else { d+=a[aa][0]; a[aa].erase(0,1); } } } cout<
发表评论
最新留言
能坚持,总会有不一样的收获!
[***.219.124.196]2025年04月16日 14时34分34秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
Android如果有一个任意写入的漏洞,如何将写权限转成执行权限
2021-05-09
三角网格体积计算
2021-05-09
现代3D图形编程学习-基础简介(2) (译)
2021-05-09
Github教程(3)
2021-05-09
vue实现简单的点击切换颜色
2021-05-09
vue3 template refs dom的引用、组件的引用、获取子组件的值
2021-05-09
深入浅出mybatis
2021-05-09
Zookeeper快速开始
2021-05-09
cas客户端流程详解(源码解析)--单点登录
2021-05-09
882. Reachable Nodes In Subdivided Graph
2021-05-09
402. Remove K Digits
2021-05-09
375. Guess Number Higher or Lower II
2021-05-09
650. 2 Keys Keyboard
2021-05-09
764. Largest Plus Sign
2021-05-09
214. Shortest Palindrome
2021-05-09
916. Word Subsets
2021-05-09
869. Reordered Power of 2
2021-05-09
1086 Tree Traversals Again
2021-05-09
1127 ZigZagging on a Tree
2021-05-09
1062 Talent and Virtue
2021-05-09