![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
模拟
文章平均质量分 79
kuronekonano
这个作者很懒,什么都没留下…
展开
-
CCF 201609-2 火车购票(模拟)
问题描述 请实现一个铁路购票系统的简单座位分配算法,来处理一节车厢的座位分配。 假设一节车厢有20排、每一排5个座位。为方便起见,我们用1到100来给所有的座位编号,第一排是1到5号,第二排是6到10号,依次类推,第20排是96到100号。 购票时,一个人可能购一张或多张票,最多不超过5张。如果这几张票可以安排在同一排编号相邻的座位,则应该安排在编号最小的相邻座位。否则应该安排在编号最小的几个空座位中(不考虑是否相邻)。 假设初始时车票全部未被购买,现在给了一些购票指令,请你处理这些指令。原创 2020-05-31 12:34:47 · 387 阅读 · 0 评论 -
leetcode 【链表反转II】
反转从位置 m 到 n 的链表。请使用一趟扫描完成反转。说明:1 ≤ m ≤ n ≤ 链表长度。示例:输入: 1->2->3->4->5->NULL, m = 2, n = 4输出: 1->4->3->2->5->NULL来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/r...原创 2019-08-18 14:59:46 · 120 阅读 · 0 评论 -
链表反转【图解】
给出一个链表的头结点,将链表反转后返回新的头结点首先假设该链表头结点【pHead】在左边,尾节点在右边设定三个指针:tmp 、p、q其中tmp和q两个指针将不断向后移动,而p指针则定在原头结点位置不动,但其next将不断跟着tmp和q指针移动。tmp q @ ——> @ ——> @ ——> @ ——> @ 初始状态 p第一步我们改变p...原创 2018-12-04 01:18:19 · 2602 阅读 · 1 评论 -
JavaScript 在网页上的图片中画矩形框,并得到实时对角坐标
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>矩形绘制工具</title> <style type="text/css"> .box { background...原创 2019-08-05 16:56:17 · 3490 阅读 · 1 评论 -
CCF【小明放学&小明上学】
题目背景 小明是汉东省政法大学附属中学的一名学生,他每天都要骑自行车往返于家和学校。为了能尽可能充足地睡眠,他希望能够预计自己上学所需要的时间。他上学需要经过数段道路,相邻两段道路之间设有至多一盏红绿灯。 京州市的红绿灯是这样工作的:每盏红绿灯有红、黄、绿三盏灯和一个能够显示倒计时的显示牌。假设红绿灯被设定为红灯 r 秒,黄灯 y 秒,绿灯 g 秒,那么从 0 时刻起,[0,r) 秒内亮红...原创 2019-03-15 10:47:54 · 405 阅读 · 0 评论 -
给一个长度为n的字符串,找出长度为m的最小字典子序列【单调栈】
头条一面挂了,除了自己菜,数据结构和基础知识理解深刻外,还有就是面试时紧张得肚子疼到抽搐。。。可能是绝症了言归正传,面试官本来想随便出个签到题玩一下开个场,结果被我紧张的崩了。结束面试之后冷静下来认真想了下并不难题目是,给出一个长度为n(1&amp;amp;amp;lt;n&amp;amp;amp;lt;10000)的只有小写字母的字符串,然后找出一个长度为m的最小字典子序列。如 orange当m=3时,输出结果age若borang...原创 2018-12-18 12:53:20 · 8021 阅读 · 11 评论 -
Codeforces Round - 509C Coffee Break(优先队列贪心模拟)
题意: 有n个喝咖啡的时间,每天只有m的时间工作,两次喝咖啡的时间间隔必须大于等于d分钟,要把所有n个咖啡时间都喝掉最少需要几天题解: 首先大体思路是,将咖啡时间按从小到大排序,可以明确的是,因为要保证两两相邻的喝咖啡时间要遵守大于等于d的限制,因此必须合理安排使得任意两个间隔小于d的喝咖啡时间错开。想到这样的方法,取出一个最小时间,可以在第一天喝,取出一个次小时间,若与第一天中的最后一次喝咖...原创 2018-09-29 23:39:02 · 266 阅读 · 0 评论 -
【2018年东北赛】UPC-7226 Memory Banks(模拟存储)
题目描述We have purchased 60 different types of memory banks, typed as 0 to 59, A bank of type i has 2i memory capacity. We have Xi memory banks of type i.We also have n workstations numbered from 1 to ...原创 2018-09-23 10:32:46 · 906 阅读 · 0 评论 -
UPC-5618 K-th K(构造)
题目描述 You are given an integer sequence x of length N. Determine if there exists an integer sequence a that satisfies all of the following conditions, and if it exists, construct an instance of a.a ...原创 2018-04-30 10:34:45 · 165 阅读 · 0 评论 -
UPC-5594 Colorful Slimes(思维)
题目描述 Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. ...原创 2018-04-12 18:22:07 · 219 阅读 · 0 评论 -
UPC-5003 Dunglish(模拟)
题目描述 A confused Dutchman trying to speak English could say “I am in the war”, even though there is no hostile activity going on. The confusion 1 here is that the English sentence “I am confused” is t...原创 2018-04-16 19:12:53 · 301 阅读 · 0 评论 -
UPC-6206 YLB搭积木(模拟小岛下沉)
题目描述 LCYZ举办了一年一度的“积木大赛”。今年比赛的内容是搭建一座宽度为n的大厦,大厦可以看成由n块宽度为1的积木组成,第i块积木的最终高度需要是hi。 在搭建开始之前,没有任何积木(可以看成n块高度为0的积木)。接下来每次操作,小朋友们可以选择一段连续区间[l,r],然后将第第L块到第R块之间(含第L块和第R块)所有积木的高度分别增加1。 YLB是个智障的小朋友,他想不出使得建造所需...原创 2018-03-28 01:33:27 · 205 阅读 · 0 评论 -
ZOJ - 4016 Mergeable Stack(模拟链表栈合并)
Given initially empty stacks, there are three types of operations:1 s v: Push the value onto the top of the -th stack.2 s: Pop the topmost value out of the -th stack, and print that value. If th...原创 2018-04-09 19:19:24 · 503 阅读 · 0 评论 -
"科林明伦杯"哈尔滨理工大学第八届程序设计竞赛——Hrbust-2378 小H的问题(模拟)
Description 小H是一个可爱的女孩,她特别喜欢看推特(tweeter)。有一天她得到了某位用户的一些推特消息,想从中提取出这个用户在这些消息中@了哪些人。但是这些消息太长了,她想请你来帮她完成这个任务。每条消息中只会包含ASCII编码中的可见字符与空格。推特中用户名的定义为一个长度大于0的字符串,且字符串中只包括数字0-9,英文字符a-z与A-Z,’-’与’_’。用户名区分大小...原创 2018-03-26 01:12:13 · 1121 阅读 · 1 评论 -
Hrbust-1014 San Guo Sha(模拟)
Description San Guo Sha is a popular Board Game. There are four kinds of cards: identity, role, life and magic card. Today we just regard the identity cards. There are four kinds of identity: Lord(ZG...原创 2018-03-25 00:07:01 · 320 阅读 · 0 评论 -
牛客网-强迫症的序列(思维)
链接:https://www.nowcoder.com/acm/contest/90/J 来源:牛客网题目描述 牛客网是IT求职神器,提供海量C++、JAVA、前端等职业笔试题库,在线进行百度阿里腾讯网易等互联网名企笔试面试模拟考试练习,和牛人一起讨论经典试题,全面提升你的编程。作为acmer的小A,牛客网是他首选的题库。 小A是一个中度强迫症患者,每次做数组有关的题目都异常难受,他十...原创 2018-03-24 22:35:50 · 836 阅读 · 0 评论 -
Codeforces Round #386 (Div. 2) D. Green and Black Tea
D. Green and Black Tea time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Innokentiy likes tea very much and today he wants to drink exactly n原创 2017-08-13 02:40:59 · 357 阅读 · 0 评论 -
Codeforces Round #386 (Div. 2) B. Decoding
B. Decoding time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Polycarp is mad about coding, that is why he writes Sveta encoded messages. He原创 2017-08-17 20:03:19 · 251 阅读 · 0 评论 -
Codeforces Round #382 (Div. 2) A. Ostap and Grasshopper
A. Ostap and Grasshopper time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output On the way to Rio de Janeiro Ostap kills time playing with a gras原创 2017-07-19 11:11:57 · 206 阅读 · 0 评论