题
文章平均质量分 80
夜雨声訉
这个作者很懒,什么都没留下…
展开
-
C. Yet Another Card Deck
You have a card deck of n cards, numbered from top to bottom, i. e. the top card has index 1 and bottom card — index n. Each card has its color: the i-th card has color ai.You should process q queries. The j-th query is described by integer tj. For each q原创 2021-04-16 12:09:42 · 397 阅读 · 1 评论 -
hdu6195cable cable cable
Problem Description Connecting the display screen and signal sources which produce different color signals by cables, then the display screen can show the color of the signal source.Notice t...原创 2019-10-24 21:13:34 · 160 阅读 · 0 评论 -
cf 259 b幻方
B. Little Elephant and Magic Squaretime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Elephant loves magic squares very much...原创 2019-08-20 09:13:02 · 179 阅读 · 0 评论 -
Codeforces 255C. Almost Arithmetical Progression
C. Almost Arithmetical Progressiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGena loves sequences of numbers. Recently, he h...原创 2019-08-20 09:04:53 · 163 阅读 · 0 评论 -
单调队列优化多重背包
#include <iostream>#include <cstring>#include<algorithm>#include <cmath>using namespace std;int dp[1000];int main(){ int n,m,s,v,w; cin>>n>>m; ...原创 2019-08-14 21:04:05 · 139 阅读 · 0 评论 -
小猫爬山AcWing165
翰翰和达达饲养了N只小猫,这天,小猫们要去爬山。经历了千辛万苦,小猫们终于爬上了山顶,但是疲倦的它们再也不想徒步走下山了(呜咕>_<)。翰翰和达达只好花钱让它们坐索道下山。索道上的缆车最大承重量为W,而N只小猫的重量分别是C1、C2……CNC1、C2……CN。当然,每辆缆车上的小猫的重量之和不能超过W。每租用一辆缆车,翰翰和达达就要付1美元,所以他们想知道,最少需要...原创 2019-08-10 15:53:05 · 259 阅读 · 0 评论 -
Codeforces 253c广搜
题目C. Text Editortime limit per test1 secondmemory limit per test256 megabytesinputinput.txtoutputoutput.txtVasya is pressing the keys on the keyboard reluctantly, squeezing out his...原创 2019-08-14 09:47:04 · 126 阅读 · 0 评论 -
codeforces 1202D 1337
题目D. Print a 1337-string...time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe subsequence is a sequence that can be derived fr...原创 2019-08-09 11:00:16 · 174 阅读 · 0 评论 -
code forces239c Not Wool Sequences
题目C. Not Wool Sequencestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA sequence of non-negative integersa1, a2, ..., anof ...原创 2019-08-07 09:21:42 · 135 阅读 · 0 评论 -
codeforces 239D Boring Partition
题目D. Boring Partitiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis problem is the most boring one you've ever seen.Gi...原创 2019-08-07 08:53:09 · 136 阅读 · 0 评论 -
codeforces670cinema
Moscow is hosting a major international conference, which is attended bynscientists from different countries. Each of the scientists knows exactly one language. For convenience, we enumerate all lang...原创 2019-08-06 17:24:25 · 97 阅读 · 0 评论 -
codeforces 225 c dp
题目C. Barcodetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou've got an n × m pixel picture. Each pixel can be white or black. Your task is to ...原创 2019-07-28 21:22:51 · 144 阅读 · 0 评论 -
codeforces 222e 矩阵快速幂
题目链接E. Decoding Genometime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently a top secret mission to Mars has taken place. As a result, scienti...原创 2019-07-28 21:09:13 · 204 阅读 · 0 评论 -
codeforces 222bCosmic Tables
题目B. Cosmic Tablestime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Free Meteor Association (FMA) has got a problem: as meteors are moving, the...原创 2019-07-28 19:40:22 · 172 阅读 · 0 评论 -
费解的开关
题目描述你玩过“拉灯”游戏吗?25盏灯排成一个5x5的方形。每一个灯都有一个开关,游戏者可以改变它的状态。每一步,游戏者可以改变某一个灯的状态。游戏者改变一个灯的状态会产生连锁反应:和这个灯上下左右相邻的灯也要相应地改变其状态。我们用数字“1”表示一盏开着的灯,用数字“0”表示关着的灯。下面这种状态1011101101101111000011011在改变了...原创 2019-08-06 09:51:20 · 123 阅读 · 0 评论 -
poj2411状压dp
题目求把N*M的棋盘分割成若干个1*2的的长方形,有多少种方案。例如当N=2,M=4时,共有5种方案。当N=2,M=3时,共有3种方案。如下图所示:输入格式输入包含多组测试用例。每组测试用例占一行,包含两个整数N和M。当输入用例N=0,M=0时,表示输入终止,且该用例无需处理。输出格式每个测试用例输出一个结果,每个结果占一行。数据范围1≤N,M≤11...原创 2019-08-20 19:00:27 · 424 阅读 · 1 评论 -
没有上司的舞会 树形dp
Ural大学有N名职员,编号为1~N。他们的关系就像一棵以校长为根的树,父节点就是子节点的直接上司。每个职员有一个快乐指数,用整数HiHi给出,其中1≤i≤N1≤i≤N。现在要召开一场周年庆宴会,不过,没有职员愿意和直接上司一起参会。在满足这个条件的前提下,主办方希望邀请一部分职员参会,使得所有参会职员的快乐指数总和最大,求这个最大值。输入格式第一行一个整数N。接...原创 2019-08-15 17:06:15 · 155 阅读 · 0 评论 -
codeforces262B
B. Roma and Changing Signstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputRoma works in a company that sells TVs. Now he has to ...原创 2019-08-21 09:21:26 · 130 阅读 · 0 评论 -
Codeforces 283. B. Cow Program记忆化搜索
outputstandard outputFarmer John has just given the cows a program to play with! The program contains two integer variables,xandy, and performs the following operations on a sequencea1, a2, .....原创 2019-10-09 21:44:59 · 263 阅读 · 0 评论 -
National Contest for Private Universities (NCPU), 2019 E. Generalized Pascal's Triangle
编辑代码 2000ms 262144K Generalized Pascal's Triangle Pascal's triangle is a triangular array in which each number can be calculated by the sum of the two numbers directly above that number as shown in ...原创 2019-09-21 20:56:56 · 172 阅读 · 0 评论 -
National Contest for Private Universities (NCPU), 2019 F. Sequence Decoding
编辑代码 1000ms 262144K Sequence Decoding The amino acids in proteins are classified into two types of elements, hydrophobic (nonpolar) and hydrophilic (polar). Hydrophobic and hydrophilic are denoted b...原创 2019-09-21 20:47:12 · 214 阅读 · 0 评论 -
The 2019 Asia Nanchang First Round Online Programming Contest MAGIC MASTER
John is not only a magic master but also a shuffling master.Famous though he is, he likes interacting with his fans by playing a game with his fantastic shuffling skills.The game shows as follo...原创 2019-09-08 19:20:03 · 283 阅读 · 0 评论 -
Codeforces 272D。Dima and Two Sequences,多重集的全排列
outputstandard outputLittle Dima has two sequences of points with integer coordinates: sequence(a1, 1), (a2, 2), ..., (an, n)and sequence(b1, 1), (b2, 2), ..., (bn, n).Now Dima wants to count...原创 2019-08-30 12:19:43 · 390 阅读 · 0 评论 -
Codeforces 254C. Anagram
C. Anagramtime limit per test1 secondmemory limit per test256 megabytesinputinput.txtoutputoutput.txtStringxis ananagramof stringy, if we can rearrange the letters in stringxa...原创 2019-08-18 10:20:52 · 283 阅读 · 0 评论 -
积累程度 poj3585
有一个树形的水系,由 N-1 条河道和 N 个交叉点组成。我们可以把交叉点看作树中的节点,编号为 1~N,河道则看作树中的无向边。每条河道都有一个容量,连接 x 与 y 的河道的容量记为 c(x,y)。河道中单位时间流过的水量不能超过河道的容量。有一个节点是整个水系的发源地,可以源源不断地流出水,我们称之为源点。除了源点之外,树中所有度数为 1 的节点都是入海口,可以吸收无限多...原创 2019-08-17 15:27:25 · 240 阅读 · 0 评论 -
codeforces266C矩阵化为下三角阵
C. Below the Diagonaltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a square matrix consisting ofnrows andnco...原创 2019-08-22 10:10:13 · 534 阅读 · 0 评论 -
codeforces 1200c
C. Round Corridortime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAmugae is in a very large round corridor. The corridor consists ...原创 2019-08-13 10:59:15 · 231 阅读 · 0 评论 -
有依赖的背包
题有NN个物品和一个容量是VV的背包。物品之间具有依赖关系,且依赖关系组成一棵树的形状。如果选择一个物品,则必须选择它的父节点。如下图所示:如果选择物品5,则必须选择物品1和2。这是因为2是5的父节点,1是2的父节点。每件物品的编号是ii,体积是vivi,价值是wiwi,依赖的父节点编号是pipi。物品的下标范围是1…N1…N。求解将哪些物品装入背包,可使...原创 2019-08-16 19:31:04 · 161 阅读 · 0 评论 -
选课
有依赖背包树形dp学校实行学分制。每门的必修课都有固定的学分,同时还必须获得相应的选修课程学分。学校开设了 N 门的选修课程,每个学生可选课程的数量 M 是给定的。学生选修了这 M 门课并考核通过就能获得相应的学分。在选修课程中,有些课程可以直接选修,有些课程需要一定的基础知识,必须在选了其他的一些课程的基础上才能选修。例如《Windows程序设计》必须在选修了《Wi...原创 2019-08-16 16:48:52 · 348 阅读 · 0 评论 -
完全背包选硬币hdu2069
Coin Change Problem Description Suppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want to make changes with these coins for a given amount of money. For...原创 2019-08-25 21:07:55 · 185 阅读 · 0 评论 -
codeforces 253D. Table with Letters - 2
题目D. Table with Letters - 2time limit per test2 secondsmemory limit per test256 megabytesinputinput.txtoutputoutput.txtVasya has recently started to learn English. Now he needs to ...原创 2019-08-16 10:55:35 · 158 阅读 · 0 评论 -
雪花雪花雪花poj3349
题目DescriptionYou may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read information about a collection of...原创 2019-08-01 21:23:16 · 281 阅读 · 0 评论 -
兔子兔子兔子
题目很久很久以前,森林里住着一群兔子。有一天,兔子们想要研究自己的 DNA 序列。我们首先选取一个好长好长的 DNA 序列(小兔子是外星生物,DNA 序列可能包含 26 个小写英文字母)。然后我们每次选择两个区间,询问如果用两个区间里的 DNA 序列分别生产出来两只兔子,这两个兔子是否一模一样。注意两个兔子一模一样只可能是他们的 DNA 序列一模一样。输入格式第一行输入...原创 2019-08-08 10:26:58 · 293 阅读 · 0 评论 -
codeforces 227E. Anniversary矩阵快速幂
题目E. Anniversarytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are less than 60 years left till the 900-th birthday anniversary of a famou...原创 2019-07-27 17:10:50 · 136 阅读 · 0 评论 -
烤面包片
题目描述 鸡尾酒最喜欢吃东北的烤面包片了。每次到东北地区的区域赛或者是秦皇岛的wannafly camp,鸡尾酒都会吃很多的烤面包片,即使比赛打铁也觉得不枉此行。“我想吃烤面包片!!!”这不,半年没吃烤面包片的鸡尾酒看到大家都聚集在秦皇岛参加暑假camp,羡慕地发出了想要的声音。当鸡尾酒“想要”的时候,他说的话会带三个感叹号来表示非常“想要”。至于有多“想要”,他给了你一个算式让你来体会。给你两个...原创 2019-07-29 09:17:51 · 234 阅读 · 0 评论 -
cf 221D
题目链接题意,给定n个数(n<=1e5)每个数<=1e9;然后给定m个区间计算每个区间内 x出现x次的数字有几个即3出现了三次算一个,2出现了2次也算一个。因为数据太大不能开1e9的数组但是他要计算次数大于1e5的数肯定不行因为数据最多一共有1e5个所以大于1e5的数据我们就忽略他不统计他的个数。而且代码中是把所有区间全部进行统计之后然后总的输出答案。#include <...原创 2019-07-24 09:40:34 · 300 阅读 · 0 评论 -
Email from Polycarp cf
cf1185b题目大意就是 一个人的键盘坏了 他的键盘每次按下去一个键就会出现一个至多个该字母 有n组数据 每次输入两个字符串 a,b问是否有可能在键盘上输入a的时候会输出b这个字符串。思路,因为是按顺序输入 所以只需要按照a的顺序遍历看b是否符合这里要注意一个坑就是当有很多个相同的字母联在一起时该怎样处理。比如ll对应llll这时我们应该a和b的两个计数变量同时相加直到a的“最后”一个相同...原创 2019-06-20 23:28:18 · 977 阅读 · 0 评论 -
POJ2189
Farmer John has two feuding herds of cattle, the Moontagues and the Cowpulets. One of the bulls in the Moontague herd, Romeo, has fallen in love with Juliet, a Cowpulet. Romeo would like to meet with...原创 2019-06-04 20:02:30 · 178 阅读 · 0 评论 -
B. Ehab Is an Odd Person
B. Ehab Is an Odd PersonYou’re given an array a of length n. You can perform the following operation on it as many times as you want:Pick two integers i and j (1≤i,j≤n)(1≤i,j≤n) such that ai+aj is ...原创 2019-06-04 19:27:11 · 749 阅读 · 1 评论 -
Best Cow Fences
POJ - 2018 这个题感受很多是个二分好题 用到了很好的技巧。题意给你n个牛的自身价值,让你找出连续的且数量大于等于F的一段区间,使这段区间内的牛的平均价值最大。将其转化为二分很不好想 枚举平均值然后计算差值的前缀和与0比较省去不少麻烦 (还是见得少)Farmer John’s farm consists of a long row of N (1 <= N <= 100...原创 2019-06-08 23:01:29 · 404 阅读 · 0 评论