
其它
一些题解
YJEthan
这个作者很懒,什么都没留下…
展开
-
HDU 1540 Tunnel Warfare(线段树区间合并)
During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay in a line. Except t原创 2018-01-19 16:03:21 · 285 阅读 · 0 评论 -
POJ 2104 K-th Number
You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quic原创 2018-01-22 14:33:19 · 267 阅读 · 0 评论 -
UVa11582 [快速幂]Colossal Fibonacci Numbers!
题意:f[]为斐波拉契数列,要你求f[a^b]%n;思路:利用斐波拉契的性质,找余数的循环节,若f[i]==1&&f[i-1]==0,则循环节为i-1;求a^b用快速幂注:UVAunsigned long long输入输出用 %llu#include#include#includeusing namespace std;typedef unsigned long l原创 2017-08-04 19:56:08 · 330 阅读 · 0 评论 -
HDU 1166 敌兵布阵 线段树
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情原创 2018-01-17 22:00:59 · 246 阅读 · 0 评论 -
中国剩余定理模板题 互质与非互质
http://www.aizhuanji.com/a/PxDygdXw.html转载 2017-07-28 11:11:15 · 399 阅读 · 0 评论 -
HDU1724[辛普森公式求积分]Ellipse
DescriptionMath is important!! Many students failed in 2+2’s mathematical test, so let's AC this problem to mourn for our lost youth..Look this sample picture: A ellipses in the pl原创 2017-08-05 09:30:24 · 650 阅读 · 1 评论 -
HDU 6156 Palindrome Function
As we all know,a palindrome number is the number which reads the same backward as forward,such as 666 or 747.Some numbers are not the palindrome numbers in decimal form,but in other base,they may beco原创 2018-01-16 20:07:45 · 252 阅读 · 0 评论 -
HDU 1754 I hate it 线段树
Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0学生ID编号分别从1编到N。第二行包原创 2018-01-17 23:06:34 · 325 阅读 · 0 评论 -
POJ 3667 hotel 线段树区间合并
有n房间,序号1-n,m次询问,询问“1 b”代表入住b人,你需要找一段连续的6间房间,若有返回序号最小的房间序号,若没有,返回0;询问“2 b c”代表清理房间b-c,清理之后b-c房间可以入住。思路:记录某区间的最大连续房间个数、区间从左边第一个开始的连续空房间个数,右边最后一个往前连续的空房间个数分别用sum、lsum、rsum表示。用cover表示某区间是否被入住,0表示全部未入住,1表示原创 2018-01-19 12:31:46 · 333 阅读 · 0 评论 -
HDU 3555 Bomb
给你一个数字n,要你求0-n中有多少个数字包含49,用n-不含49的个数即答案。#includeusing namespace std;typedef long long ll;ll dp[20][10];//记录在i位,前一位是j的符合条件的个数int a[20];//ll dfs(ll pos,ll pre,ll lim)//当前的位置,前一位数,前一位是否是前一位的最大数{原创 2018-01-16 19:21:30 · 279 阅读 · 0 评论 -
UVA5009 Error Curves三分
题意:求一些开口向上的凹函数的最大值的最小值(不懂就仔细读两遍)分析:一些开口向上的凹函数的最大值的最小值仍然是凹函数求凹凸函数的最值明显用三分。详见代码,类似二分,只不过三分在中间取两个点,函数那不懂,多画图自己就能写出来。#include#include#includeusing namespace std;int n,a[10002],b[10002],c[10002];原创 2017-08-04 20:10:37 · 323 阅读 · 0 评论 -
HDU 1542 Atlantis 矩形面积并
Problem DescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, t原创 2018-01-18 19:31:53 · 277 阅读 · 0 评论 -
hdu1394 Minimum Inversion Number 逆序数、最小逆序数
Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj.For a given sequence of numbers a1, a2, ..., an, if we move the fi原创 2018-01-18 13:35:42 · 308 阅读 · 0 评论 -
HDU 3709 Balanced Number
A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit as a box with weight indicated by the digit. When a pivot is原创 2018-01-16 19:38:19 · 273 阅读 · 0 评论 -
HDU 1255 覆盖的面积,矩形面积交
Problem Description给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积. Input输入数据的第一行是一个正整数T(1注意:本题的输入数据较多,推荐使用scanf读入数据. Output对于每组测试数据,请计算出被这些矩形覆盖过至少两次的区域的面积.结果保留两位小数. Sample Input251 1 4 21 3 3 72 1.5 5 4.53.5 1.2原创 2018-01-18 23:10:03 · 343 阅读 · 0 评论 -
UVA10341 solve it 二分
题意:求f(x)=p*e^-x+q*sin(x)+r*cos(x)+s*tan(x)+t*x*x+u=0,0思路二分;#include#includetypedef double dd;int p,q,r,s,t,u;dd solve(dd x){ return p*exp(-x)+q*sin(x)+r*cos(x)+s*tan(x)+t*x*x+u;}int ma原创 2017-08-04 19:58:04 · 331 阅读 · 0 评论 -
Codeforces Round #479 (Div. 3)
Codeforces Round #479 (Div. 3)原创 2018-05-09 23:09:20 · 301 阅读 · 0 评论 -
Light oj 1140 How Many Zeroes?
Jimmy writes down the decimal representations of all natural numbers between and including m and n, (m ≤ n). How many zeroes will he write down?InputInput starts with an integer T (≤ 11000), denot原创 2018-01-16 19:50:43 · 327 阅读 · 0 评论 -
POJ 3070 Fibonacci
DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, andFn = Fn − 1 + Fn − 2 forn ≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2, 3, 5, 8, 13, 21,原创 2017-08-04 20:12:20 · 349 阅读 · 0 评论 -
POJ 2417 Discrete Logging BSGS
Given a prime P, 2 31, an integer B, 2 BL == N (mod P)InputRead several lines of input, each containing P,B,N separated by a space.OutputFor each line print the logarithm on a sepa原创 2018-01-16 20:21:52 · 316 阅读 · 0 评论 -
J - Wooden Sticks poj 1065
DescriptionThere is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashion. It needs s原创 2017-07-15 09:43:42 · 291 阅读 · 0 评论 -
I - Dollar Dayz
DescriptionFarmer John goes to Dollar Days at The Cow Store and discovers an unlimited number of tools on sale. During his first visit, the tools are selling variously for $1, $2, and $3. Farmer J原创 2017-07-13 10:55:59 · 339 阅读 · 0 评论 -
C - Common Subsequence
DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exists a转载 2017-07-13 09:31:25 · 502 阅读 · 0 评论 -
code force Party Lemonade
A New Year party is not a New Year party without lemonade! As usual, you are expecting a lot of guests, and buying lemonade has already become a pleasant necessity.Your favorite store sells lemona原创 2018-01-14 20:21:37 · 388 阅读 · 0 评论 -
E - Apple Catching
It is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, each full of apples. Bessie cannot reach the apples when they a原创 2017-07-13 10:22:39 · 622 阅读 · 0 评论 -
F - Charm Bracelet
DescriptionBessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from theN (1 ≤ N ≤ 3,402) available charms.原创 2017-07-13 10:47:25 · 399 阅读 · 0 评论 -
G - Cow Bowling
DescriptionThe cows don't use actual bowling balls when they go bowling. They each take a number (in the range 0..99), though, and line up in a standard bowling-pin-like triangle like this:原创 2017-07-13 10:51:16 · 352 阅读 · 0 评论 -
B - Bridging signals
Description'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed up completely, making the signals on the chip connec原创 2017-07-13 09:12:56 · 381 阅读 · 0 评论 -
D - 滑雪
DescriptionMichael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14原创 2017-07-13 10:04:22 · 369 阅读 · 0 评论 -
H - Sumsets POJ 2229
DescriptionFarmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer power of 2. Here are the possible sets原创 2017-07-15 09:26:08 · 442 阅读 · 0 评论