list的使用-Hdu 1276
士兵队列训练问题
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 18547 Accepted Submission(s): 7903
#include <bits/stdc++.h> using namespace std; int main()
{
int t,n;
cin>>t;
while(t--){
cin>>n;
int k = ;
list<int>mylist;
list<int>::iterator it;
for(int i = ;i <= n; i++)
mylist.push_back(i);
while(mylist.size()>){
int num = ;
for(it = mylist.begin(); it != mylist.end();){
if(num++ % k == )
it = mylist.erase(it);
else
it++;
}
k==?k=:k=;
}
for(it = mylist.begin();it != mylist.end();it++){
if(it != mylist.begin())
cout<<" ";
cout<<*it;
}
cout<<endl;
}
return ;
}
list的使用-Hdu 1276的更多相关文章
- HDU 1276 士兵队列训练问题(模拟)
原题代号:HDU 1276 原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1276 题目原题: 士兵队列训练问题 Time Limit: 2000/10 ...
- hdu 1276士兵队列问题【queue】
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1276 士兵队列训练问题 ...
- HDU 1276 士兵队列训练问题(队列)
题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=1276 题目: 士兵队列训练问题 Time Limit: 2000/1000 MS (Java/Othe ...
- HDU 1276 士兵队列训练问题
模拟题,学了一下list it=li.erase(it):指向删除后的第一个元素 #include <cstdio> #include <list> using namespa ...
- 解题报告:hdu 1276 士兵队列训练问题 - 简单题
Problem Description 某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠拢,再从头开始进行 ...
- ACM学习历程—HDU 1276 士兵队列训练问题(队列)
Description 某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠 拢,再从头开始进行一至三报数,凡 ...
- HDU题解索引
HDU 1000 A + B Problem I/O HDU 1001 Sum Problem 数学 HDU 1002 A + B Problem II 高精度加法 HDU 1003 Maxsu ...
- 第一周训练 | STL和基本数据结构
A - 圆桌问题: HDU - 4841 #include<iostream> #include<vector> #include<stdio.h> #includ ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
随机推荐
- python3爬取高清壁纸(1)
这次爬取的目标是:美桌网首页 > 桌面壁纸 > 卡通动漫 类别下的壁纸. 我们先随机选取一个专辑来爬(http://www.win4000.com/wallpaper_detail_545 ...
- blur()低通滤波
blur()函数可以用标准化的盒式过滤器来平滑图像. C++ API: 相关官网资料: https://docs.opencv.org/3.4.1/d4/d86/group__imgproc__fil ...
- spring(四):Resource
Resource Spring的Resource接口代表底层外部资源,提供了对底层外部资源的一致性访问接口. public interface Resource extends InputStream ...
- 2.7.2 元素定位:frame 内定位 driver.switch_to.frame()
来源: http://blog.csdn.net/anniejunyan/article/details/23257327 Selenium + Webdriver 学习(五) frame下元素定位 ...
- 通过FormData对象可以组装一组用 [XMLHttpRequest]发送请求的键/值对,它可以更灵活方便的发送表单数据。
工作记录用 1 大概页面,点击选择按钮,选择文件,填写备注并可以上传前预览,然后点击上传按钮开始上传 2 html+js代码 <h2>Test</h2> <div id= ...
- web布局相关
1.用table布局时,如果设置了table-layout:fixed或者对第一行的两个列进行了合并后导致后面的列宽度失效,这是可以使用 <colgroup> <col ...
- 2020最新版idea激活教程
windows破解教程 首先下载jar包:(云盘链接发不上去,大家关注gzh"灰太狼学爪哇"回复idea获取)将其放到合适的文件夹(首选IDEA的同级目录)进行管理: 进入C盘 - ...
- select id from BS_BU_RULETYPE t start with t.PARENT_ID = 175 connect by t.PARENT_ID = prior t.id
select id from BS_BU_RULETYPE t start with t.PARENT_ID = 175 connect by t.PARENT_ID = prior t.id
- sublime3使用技巧
1.鼠标悬浮,显示文件引用 Preference ——> Settings ——> "index_files": true (保存,重新打开即可) 2 ...
- 【音乐欣赏】《Fake》 - The Tech Thieves
曲名:Fake 作者:The Tech Thieves [01;12.092]I got wasted,learning how to let it out [01;24.009]Please don ...