![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法题目
文章平均质量分 75
LxcXingC
这个作者很懒,什么都没留下…
展开
-
【无标题】
next()方法以空格与回车为结束符nextLine()方法只以回车为结束符charAt(int)方法返回下标处的单个字符toUpperCase() toLowerCase()方法把string全部转换为大小写hasNext()函数用于多组输入原创 2022-02-20 18:39:09 · 330 阅读 · 0 评论 -
HDU 6343 Problem L. Graph Theory Homework (思维)
hdu 6343There is a complete graph containing n vertices, the weight of the i-th vertex is wi.The length of edge between vertex i and j (i≠j) is .Calculate the length of the shortest path from 1 to...原创 2018-08-02 17:07:19 · 251 阅读 · 2 评论 -
HDU 6354 Everything Has Changed (多校水题)
hdu 6354题目:Problem DescriptionEdward is a worker for Aluminum Cyclic Machinery. His work is operating mechanical arms to cut out designed models. Here is a brief introduction of his work.Assume...原创 2018-08-12 13:34:34 · 526 阅读 · 0 评论 -
HDU 6362 oval-and-rectangle (多校水题)
hdu 6362题目:Problem DescriptionPatrick Star find an oval.The half of longer axes is on the x-axis with length a.The half of shorter axes is on the y-axis with length b.Patrick Star plan to cho...原创 2018-08-12 16:52:08 · 341 阅读 · 0 评论 -
HDU 6373 Pinball (物理)
hdu 6373题目:There is a slope on the 2D plane. The lowest point of the slope is at the origin. There is a small ball falling down above the slope. Your task is to find how many times the ball has be...原创 2018-08-12 17:25:13 · 310 阅读 · 0 评论 -
HDU 1260 Tickets (线性DP)
hdu 1260题目:Jesus, what a great movie! Thousands of people are rushing to the cinema. However, this is really a tuff time for Joe who sells the film tickets. He is wandering when could he go back h...原创 2018-08-13 19:06:52 · 195 阅读 · 0 评论 -
CF 1016C Vasya And The Mushrooms (DP)
codeforces 1016c题目:Vasya's house is situated in a forest, and there is a mushroom glade near it. The glade consists of two rows, each of which can be divided into n consecutive cells. For each cel...原创 2018-08-16 09:23:02 · 401 阅读 · 0 评论 -
HDU 6153 A Secret (KMP)
http://acm.hdu.edu.cn/showproblem.php?pid=6153题目: Problem DescriptionToday is the birthday of SF,so VS gives two strings S1,S2 to SF as a present,which have a big secret.SF is interested in th...原创 2018-08-16 18:59:20 · 211 阅读 · 0 评论 -
An Olympian Math Problem
Alice, a student of grade 666, is thinking about an Olympian Math problem, but she feels so despair that she cries. And her classmate, Bob, has no idea about the problem. Thus he wants you to help him...原创 2018-09-05 14:36:47 · 393 阅读 · 1 评论 -
山东省第二届ACM大学生程序设计竞赛 I - Sequence
题目链接SequenceTime Limit: 1000 ms Memory Limit: 65536 KiBProblem DescriptionGiven an integer number sequence A of length N (1<=N<=1000), we define f(i,j)=(A[i]+A[i+1]+...+A[j])^2 (i&...原创 2019-02-26 19:31:59 · 275 阅读 · 0 评论 -
Boring count (尺取法)
You are given a string S consisting of lowercase letters, and your task is counting the number of substring that the number of each lowercase letter in the substring is no more than K.InputIn the ...原创 2019-03-10 19:06:53 · 279 阅读 · 0 评论 -
19年山东省赛 Happy Equation (数论)
Little Sub has just received an equation, which is shown below, as his birthday gift.Given the value of , please help Little Sub count the number of () which satisfies the equation.InputThere ar...原创 2019-05-13 21:44:58 · 638 阅读 · 0 评论 -
牛牛与数组(简单dp)
链接:https://ac.nowcoder.com/acm/problem/21738来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述牛牛喜欢这样的数组:1:长度为n2:每一个数都在1到k之间3:对于任意连续的两个数A,B,A<=B 与(A % B !=...原创 2019-05-27 19:48:54 · 865 阅读 · 0 评论 -
被3整除的子序列(线性dp)
时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述给你一个长度为50的数字串,问你有多少个子序列构成的数字可以被3整除答案对1e9+7取模输入描述:输入一个字符串,由数字构成,长度小于等于50输出描述:输出一个整数示例1输入复制132输出复制3示...原创 2019-05-28 21:08:11 · 2296 阅读 · 2 评论 -
HDU 5835 Danganronpa (贪心)
hdu 5835 题目:Problem DescriptionChisa Yukizome works as a teacher in the school. She prepares many gifts, which consist of n kinds with a[i] quantities of each kind, for her students and wants to...原创 2018-08-14 16:41:51 · 243 阅读 · 0 评论 -
Halloween Costumes (区间DP)
VJ链接题目:Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it's Halloween, these parties are all costume p...原创 2018-08-02 10:52:12 · 471 阅读 · 0 评论 -
HDU 5832 A water problem (高精度取模)
hdu 5832题目:Problem DescriptionTwo planets named Haha and Xixi in the universe and they were created with the universe beginning.There is 73 days in Xixi a year and 137 days in Haha a year.Now ...原创 2018-08-14 14:38:38 · 185 阅读 · 0 评论 -
剪花布条——kmp
一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢?Input输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不再进行工作。Outpu...原创 2018-01-21 20:13:45 · 282 阅读 · 0 评论 -
HDU 6299 Balanced Sequence (模拟贪心)
题目:Chiaki has n strings s1,s2,…,sn consisting of '(' and ')'. A string of this type is said to be balanced:+ if it is the empty string+ if A and B are balanced, AB is balanced,+ if A is balanced,...原创 2018-07-29 17:15:02 · 265 阅读 · 0 评论 -
数位DP入门 —— hdu2089 不要62
数位DP是一种用来计数的DP, 如果给你一道题, 让你去统计区间[l, r]之间满足某种条件的数字个数, 在没接触数位之前很容易想到的就是暴力判断。但当数据范围较大时这种方法就不可行了, 这时候我们就可能要用的差分的思想确定一个递推关系, 来更方便更高效的求解, 这就是数位DP。这种理论的东西可能写出来帮助不大, 数位DP的思想是通过自己对问题的思考逐渐建立的, 下面是我选的一个例题来帮助初步理解...原创 2018-07-27 14:21:27 · 353 阅读 · 2 评论 -
SDNU OJ 1025 马踏飞燕
该题是一道使用BFS(广度优先搜索)的经典题目(当然如果你不怕麻烦,DFS也是可以的), 思路很简单,用queue存下各个情况每次都判断是否踏到燕子,并且记得记录深度。Description无聊的陶陶准备编写一款游戏,名字就叫做“马踏飞燕”,在这款游戏中有个一个100*100的坐标,把马放在任意一个坐标点,再把燕子放在任意一个坐标点,并且燕子不会移动,马只能按照象棋规则走“日”。若4步之内...原创 2017-11-24 22:40:29 · 734 阅读 · 0 评论 -
POJ 3061 Subsequence (尺取法)
poj 3061题目:DescriptionA sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program ...原创 2018-08-09 09:26:32 · 195 阅读 · 0 评论 -
区间DP入门及平行四边形优化
区间DP, 指的就是对区间的DP, 主要的思想是依旧是最优子结构和无后效性的确保, 一般思路就是先对小区间进行操作得到最优解, 然后通过小区间的最优解来得到大区间的最优解。利用dp[i][j]数组来表示从 i 到 j 区间合并的最优值。这里笔者给出基本的区间DP模板帮助理解://n是区间长度,dp[i][j]存从i 到 j 区间合并的最优值//w[i][j]表示从i 到 j的花费...原创 2018-07-31 11:07:07 · 3093 阅读 · 1 评论 -
POJ 2955 Brackets (区间DP)
题目链接:POJ 2955 We give the following inductive definition of a “regular brackets” sequence:the empty sequence is a regular brackets sequence, if s is a regular brackets sequence, then (s) and [s...原创 2018-07-31 16:18:39 · 193 阅读 · 0 评论 -
LIS(最长上升子序列)的 n ^ 2, nlogn解法以及路径标记
最长上升子序列(Longest Increasing Subsequence,LIS)是一个数列中最长的(非)严格上升的子序列, LIS的求解是DP思想的一个经典体现, 这里通过例题来介绍两种复杂度不同的解法和一个标记路径的问题。一. n ^ 2 解法(双层循环递推关系式)例:hdu 1160链接戳我题意是一只老鼠有体重跟速度两种属性, 每一行会都会输入一只老鼠的体重和速度,同时每...原创 2018-07-30 08:59:55 · 2638 阅读 · 3 评论 -
POJ 1160 Post Office(区间DP)
poj 1160Post OfficeTime Limit: 1000MS Memory Limit: 10000K Total Submissions: 21315 Accepted: 11522 DescriptionThere is a straight highway with villages alongside the highway...原创 2018-08-01 11:16:04 · 471 阅读 · 5 评论 -
HDU 1029 Ignatius and the Princess IV (简单DP)
hdu 1029题目:Ignatius and the Princess IVTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32767 K (Java/Others)Total Submission(s): 42940 Accepted Submission(s): 18774 Problem ...原创 2018-08-01 13:16:12 · 307 阅读 · 0 评论 -
HDU 2476 String painter (区间DP)
hdu 2476题目:Problem DescriptionThere are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help of the painte...原创 2018-08-10 14:52:52 · 182 阅读 · 0 评论 -
HDU 1024 Max Sum Plus Plus (最大M子串和优化)
hdu 1024题目:Max Sum Plus PlusTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 36636 Accepted Submission(s): 13050 Problem Description...原创 2018-08-01 20:30:39 · 213 阅读 · 0 评论 -
大数加法
在处理某些问题的时候有时会遇到及其庞大的数字,数字型的变量可能不能完全容纳,那么此时我们可以用字符串来实现庞大数字的运算。将字符串存入数组中,a[0](a[1]也可以)是最低位,从最低位开始加,将每位相加的结果存入另一个数组中,要考虑的是进位的问题,可以依次处理每一位向前进位,最后再输出即可。以下代码为边加边进位的方式,也可以选择先加完,最后进位。 #include<std...原创 2017-11-10 10:02:19 · 204 阅读 · 0 评论