POJ 3629 队列模拟
来源:互联网 发布:广州网络危机公关公司 编辑:程序博客网 时间:2024/06/05 18:24
听说STL会卡T
然后我就试了一发
哈哈哈哈哈哈哈哈哈哈 1000ms卡时过的
这很值得我写一发题解了 哈哈哈哈哈哈哈哈哈哈哈哈
//By SiriusRen#include <queue>#include <cstdio>#include <algorithm>using namespace std;int n,k,mod,rnd,p,ans[1000050],top;queue<int>q;int main(){ scanf("%d%d%d",&mod,&k,&p),n=mod-1; for(int i=1;i<=k;i++)q.push(i); while(1){ if(rnd==n)rnd=0,ans[++top]=q.front(); else rnd++; q.pop(); if(q.empty())break; for(int i=1;i<=p;i++){ int t=q.front();q.pop(); q.push(t); } } sort(ans+1,ans+1+top); for(int i=1;i<=top;i++) printf("%d\n",ans[i]);}
0 0
- POJ 3629 队列模拟
- poj 3629 Card Stacking 模拟队列
- POJ 3032 简单队列模拟
- poj 3125(模拟队列)
- POJ 1208 TheBlocks Problem (模拟+队列)
- POJ 3125 Printer Queue 模拟队列
- Sequence 优先队列模拟堆 poj 2442
- POJ 3282 Ferry Loading IV(模拟,队列)
- POJ 3282 Ferry Loading IV(模拟,队列)
- poj 3984 迷宫问题(模拟队列)
- POJ 2259 Team Queue(队列模拟)
- POJ 2259 Team Queue【模拟队列】
- [POJ](3984)迷宫问题 ---BFS+队列模拟(图+队列模拟)***
- POJ 3125 && Sicily 1443 Printer Queue(模拟/队列)
- POJ 3125 && Sicily 1443 Printer Queue(模拟/队列)
- POJ 1862 变形虫合成 模拟题 优先权队列
- POJ 3125 Printer Queue【简单模拟a打印队列】
- POJ 3125 Printer Queue(打印队列---模拟)
- Solidity 文档--第一章:智能合约入门
- 企业级系统模块通信:面向服务RPC和消息中间件
- Android之CursorAdapter用法
- 学习笔记:The Log(我所读过的最好的一篇分布式技术文章)
- Java并发编程之一:多线程的两种实现
- POJ 3629 队列模拟
- 通信传播的各种效应
- OpenCv中IplImage图像格式与BYTE图像数据的转换
- 一个简单的Android 动态Fragment实例
- 关于Qt中的tr()函数讲解
- MATLAB 调用程序中断点问题
- 多线程的join()方法
- Xcode8更新后问题总结与解决
- HIVE备份之批量导出所有的HIVE建表字段