随笔分类 -  ACM

摘要:一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? 入门题:直接套模板就好,不会KMP的同学上网随便找一篇大佬的博客就可以了(自己写起来太麻烦了) #define _CRT_SECURE_NO_WARNING 阅读全文
posted @ 2020-08-14 19:22 夜灯长明 阅读(165) 评论(0) 推荐(0)
摘要:给出n对字符串,p,s;想要知道p在s中出现了几次。 #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<cstring> #include<stdio.h> #include<algorithm> #include<map> #i 阅读全文
posted @ 2020-08-13 20:28 夜灯长明 阅读(270) 评论(0) 推荐(0)
摘要:#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<cstring> #include<stdio.h> #include<algorithm> #include<map> #include<queue> #include<set> 阅读全文
posted @ 2020-08-13 19:27 夜灯长明 阅读(166) 评论(0) 推荐(0)
摘要:有N个人排队,每一个人都有一个val来对应,每一个后来人都会插入当前队伍的某一个位置pos。要求把队伍最后的状态输出。 第一行一个整数N,表示n个人 接下来n行,每行两个整数x和val,表示一个标记为val的人,插入到排在第x位置的人的后面。 从前往后,输出所有的val 思路:从后往前读入,记录当前 阅读全文
posted @ 2020-07-29 19:21 夜灯长明 阅读(120) 评论(0) 推荐(0)
摘要:给一个序列,我们使用冒泡排序法对它进行排序。请输出在排序过程中会进行多少次交换。 参考大佬:https://www.cnblogs.com/shenshuyang/archive/2012/07/14/2591859.html #define _CRT_SECURE_NO_WARNINGS #inc 阅读全文
posted @ 2020-07-26 23:27 夜灯长明 阅读(92) 评论(0) 推荐(0)
摘要:有一个正方形游戏背包,大小为S*S(1<=S<=1024)。含有很多小格子,小格子编号从0开始,直到S-1。每一个格子里有一定数量的物品,同时每一个格子的物品里的数目也是不断变化的,现在要一边进行修改某些单位格子内的物品的数目,同时也要询问某些区域的手机数目。 数据保证每个格子内物品数目一直在int 阅读全文
posted @ 2020-07-26 20:27 夜灯长明 阅读(147) 评论(0) 推荐(0)
摘要:At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place wher 阅读全文
posted @ 2020-07-24 21:25 夜灯长明 阅读(114) 评论(0) 推荐(0)
摘要:题意:给你一个长度为N节的金属钩子,钩子分为铜,银,金三种。 铜为1,银为2,金为3; 一开始都是铜钩子,经过q次变化后,问N节钩子的数目之和。 #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<cstring> #include 阅读全文
posted @ 2020-07-24 19:39 夜灯长明 阅读(86) 评论(0) 推荐(0)
摘要:一个人养lyd,每盆lyd都有一个价值,lyd是排成一行。有三个操作:有时某盆lyd的价值会上升,有时某盆lyd的价值会下降。有时他想知道某段连续的lyd的价值之和是多少,你能快速地告诉她结果吗? 第一行一个整数T,表示有T组测试数据。 每组测试数据的第一行为一个正整数N (N<=50000),表示 阅读全文
posted @ 2020-07-21 00:17 夜灯长明 阅读(100) 评论(0) 推荐(0)
摘要:N (2 <= N <= 8,000) cows have unique brands in the range 1..N. In a spectacular display of poor judgment, they visited the neighborhood 'watering hole 阅读全文
posted @ 2020-07-14 19:28 夜灯长明 阅读(147) 评论(0) 推荐(0)
摘要:有n个箱子,初始时每个箱子单独为一列; 接下来有p行输入,M, x, y 或者 C, x; 对于M,x,y:表示将x箱子所在的一列箱子搬到y所在的一列箱子上; 对于C,x:表示求箱子x下面有多少个箱子 思路:开一个num数组,表示第i个箱子所在的集合共有多少个箱子。 开一个step数组,表示第i个箱 阅读全文
posted @ 2020-06-10 19:24 夜灯长明 阅读(170) 评论(0) 推荐(0)
摘要:Bug有两种性别,异性之间才交往, 让你根据数据判断是否存在同性恋,输入有 t 组数据,每组数据给出bug数量n, 和关系数m, 以下m行给出相交往的一对Bug编号 a, b。只需要判断有没有,按题目要求输出。 思路:我们开一个两倍的数组,存上对应的关系。 例如:有n个bug,其中(2, 3),(3 阅读全文
posted @ 2020-06-09 22:48 夜灯长明 阅读(203) 评论(0) 推荐(0)
摘要:An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unex 阅读全文
posted @ 2020-06-09 22:08 夜灯长明 阅读(149) 评论(0) 推荐(0)
摘要:动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种 阅读全文
posted @ 2020-06-09 20:31 夜灯长明 阅读(194) 评论(0) 推荐(0)
摘要:The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. H 阅读全文
posted @ 2020-06-05 15:23 夜灯长明 阅读(592) 评论(0) 推荐(0)
摘要:题意:给你两个字符串s1,s2;你需要用最小变化次数把是s1变成s2;变化规则如下: 在s1中任意选择k个字符,选择k个字符中字典序最小的si,让k个字符都变成si; #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<cstrin 阅读全文
posted @ 2020-06-04 23:47 夜灯长明 阅读(208) 评论(0) 推荐(0)
摘要:版权声明:本文为CSDN博主「飘过的小牛」的原创文章原文链接:https://blog.csdn.net/niushuai666/article/details/6662911 大佬写的太好了,取来自用orz。 话说江湖上散落着各式各样的大侠,有上千个之多。他们没有什么正当职业,整天背着剑在外面走来 阅读全文
posted @ 2020-06-03 22:20 夜灯长明 阅读(255) 评论(0) 推荐(0)
摘要:Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize 阅读全文
posted @ 2020-06-03 02:21 夜灯长明 阅读(147) 评论(0) 推荐(0)
摘要:There are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many di 阅读全文
posted @ 2020-06-03 01:29 夜灯长明 阅读(137) 评论(0) 推荐(0)
摘要:Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to 阅读全文
posted @ 2020-06-03 01:13 夜灯长明 阅读(158) 评论(0) 推荐(0)