题目链接: Basic Data Structure Time Limit: 7000/3500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 207 Accepted Submission(s): 41 Problem Description Mr. Frog learned a basic data structure recently, which is called…
题目很简单,给一个队列以及文件的位置,然后一个一个检查,如果第一个是优先级最高的就打印,否则放到队列后面,求所要打印的文件打印需要花费多长时间. 这里我用数组模拟队列实现,考虑到最糟糕的情况,必须把数组开到maxn*maxn.另外当所要打印的文件优先级不是最高的时候也需要排列到后面. 0.016s. 代码: #include <cstdio> const int maxn = 101; int t, n, m, time; int q[maxn*maxn]; int print() { int…
接下来的几篇博客会介绍下juc包下的相关数据结构 包含queue,list,map等 这篇文章主要模拟下阻塞队列. 下面是代码 import java.util.LinkedList; import java.util.concurrent.atomic.AtomicInteger; public class MyBlockingQueue<T> { private final LinkedList<T> queue = new LinkedList<>(); priv…
Heather银行打算在Food Heap超市开设一个自动柜员机(ATM).Food Heap超市的管理者担心排队使用ATM的人流会干扰超市的交通,希望限制排队等待的人数.Heather银行希望对顾客排队等待的事件进行估测.要编写一个程序来模拟这种情况,让超市的管理者可以了解ATM可能招骋的影响.对于这种问题,最自然的方法是使用顾客对列.队列是一种抽象的数据类型(Abstract Data Type,ADT),可以存储有序的项目序列.新项目被添加在队尾,并可以删除队首的项目.队列有点像栈,单栈在…
看病要排队 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10720 Accepted Submission(s): 4515 Problem Description 看病要排队这个是地球人都知道的常识. 不过经过细心的0068的观察,他发现了医院里排队还是有讲究的.0068所去的医院有三个医生(汗,这么少)同时看病.而看病的人…
Team Queue Queues and Priority Queues are data structures which are known to most computer scientists. The Team Queue, however, is not so well known, though it occurs often in everyday life. At lunch time the queue in front of the Mensa is a team que…
转载请注明出处:viewmode=contents">http://blog.csdn.net/u012860063? viewmode=contents 题目链接:http://poj.org/problem? id=3077 Description For a given number, if greater than ten, round it to the nearest ten, then (if that result is greater than 100) take the…
http://poj.org/problem?id=1068 #include<cstdio> #include <cstring> using namespace std; int ind[45]; bool used[45]; int r[21]; int l[21]; int len,n,llen; int w[21]; int main(){ int t; scanf("%d",&t); while(t--){ memset(used,0,siz…