L2-1 包装机 (25 分)
发布日期:2021-05-07 07:25:14 浏览次数:25 分类:精选文章

本文共 589 字,大约阅读时间需要 1 分钟。

容器会的不多,但是就是个模拟

利用个erase();
就行了。

#include
using 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<
上一篇:K8S入门学习笔记第七天,service意义,service类型,svc代理模式,Ingress域名访问测试
下一篇:K8S入门学习笔记第六天,nodeSelector,nodeAffinity,Taint,DaemonSet控制器

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2025年04月16日 14时34分34秒