题目链接:https://ac.nowcoder.com/acm/contest/993/ABessie is playing a card game with her N-1 (2 <= N <= 100) cow friends using a deck with K (N <= K <= 100,000; K is a multiple of N) cards. The deck contains M = K/N "good" cards and K-M…
题目链接: 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),可以存储有序的项目序列.新项目被添加在队尾,并可以删除队首的项目.队列有点像栈,单栈在…
Compass Card Sales 时间限制: 3 Sec 内存限制: 128 MB提交: 35 解决: 13[提交] [状态] [讨论版] [命题人:admin] 题目描述 Katla has recently stopped playing the collectible card game Compass. As you might remember, Compass is a game where each card has a red, a green and a blue an…
看病要排队 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…