
HDU
鸩羽小夜
我是小垃圾,垃圾中的战斗圾
展开
-
POJ3264Balanced Lineup (线段树+区间查询+同时建立两个线段树)
For the daily milking, Farmer John'sNcows (1 ≤N≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things ...原创 2019-11-19 12:01:29 · 100 阅读 · 0 评论 -
HDU1754I hate it(区间查询,单点修改)
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=200000,0<M<5...原创 2019-11-19 11:56:37 · 130 阅读 · 0 评论 -
HDU2795Billboard(线段树,单点修改)
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 where all possible announcements are posted: nearest p...原创 2019-11-19 11:51:32 · 104 阅读 · 0 评论 -
HDU4027Can you answer these queries? (线段树区间查询+区间修改)
A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be marked a value of end...原创 2019-11-18 21:19:24 · 160 阅读 · 0 评论 -
HDU1394 Minimum Inversion Number (线段树,单点修改*,区间查询*,逆序数)
The inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < j and ai > aj.For a given sequence of numbers a1, a2, ..., an, if we move the f...原创 2019-11-11 22:01:48 · 218 阅读 · 0 评论 -
HDU3577Fast Arrangement(最大值线段树+区间更新)
Chinese always have the railway tickets problem because of its' huge amount of passangers and stations. Now goverment need you to develop a new tickets query system.One train can just take k passang...原创 2019-11-04 21:48:39 · 142 阅读 · 0 评论 -
HDU1584蜘蛛牌(经典DFS,理解回溯)
蜘蛛牌是windows xp操作系统自带的一款纸牌游戏,游戏规则是这样的:只能将牌拖到比她大一的牌上面(A最小,K最大),如果拖动的牌上有按顺序排好的牌时,那么这些牌也跟着一起移动,游戏的目的是将所有的牌按同一花色从小到大排好,为了简单起见,我们的游戏只有同一花色的10张牌,从A到10,且随机的在一行上展开,编号从1到10,把第i号上的牌移到第j号牌上,移动距离为abs(i-j),现在你要做的是求...原创 2019-10-25 16:29:07 · 151 阅读 · 0 评论 -
HDU1999不可摸数(数论,筛法,埃拉特斯特尼筛法)
题目链接https://vjudge.net/problem/HDU-1999s(n)是正整数n的真因子之和,即小于n且整除n的因子和.例如s(12)=1+2+3+4+6=16.如果任何数m,s(m)都不等于n,则称n为不可摸数.Input包含多组数据,首先输入T,表示有T组数据.每组数据1行给出n(2<=n<=1000)是整数。Output如果n是不可摸数,...原创 2019-10-23 14:21:03 · 243 阅读 · 0 评论 -
HDU5015 233 Matrix(矩阵构造+矩阵快速幂)
In our daily life we often use 233 to express our feelings. Actually, we may say 2333, 23333, or 233333 ... in the same meaning. And here is the question: Suppose we have a matrix called 233 matrix. I...原创 2019-10-20 19:13:58 · 125 阅读 · 0 评论 -
HDU4990Reading comprehension (矩阵快速幂构造)奇怪
Read the program below carefully then answer the question.#pragma comment(linker, "/STACK:1024000000,1024000000")#include <cstdio>#include<iostream>#include <cstring>#inclu...原创 2019-10-18 23:25:28 · 123 阅读 · 0 评论 -
HDU2899Strange fuction (三分)应该也可以二分
Now, here is a fuction:F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100)Can you find the minimum value when x is between 0 and 100.InputThe first line of the input contains an intege...原创 2019-10-18 23:09:56 · 93 阅读 · 0 评论 -
HDU2199Can you solve this equation? (二分经典入门题)
Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,can you find its solution between 0 and 100;Now please try your lucky.InputThe first line of the input contains an integer T(1<=T&l...原创 2019-10-18 23:02:55 · 124 阅读 · 0 评论 -
HDU5667Sequence (矩阵构造+费马小定理+矩阵快速幂)
Holion August will eat every thing he has found.Now there are many foods,but he does not want to eat all of them at once,so he find a sequence.fn=⎧⎩⎨⎪⎪1,ab,abfcn−1fn−2,n=1n=2otherwisefn={1...原创 2019-10-18 22:56:46 · 308 阅读 · 0 评论 -
HDU4686An Arc of Dream(矩阵构造****+矩阵快速幂+模运算)
An Arc of Dream is a curve defined by following function:wherea0= A0ai= ai-1*AX+AYb0= B0bi= bi-1*BX+BYWhat is the value of AoD(N) modulo 1,000,000,007?InputThere are mult...原创 2019-10-16 19:27:01 · 144 阅读 · 0 评论 -
HDU1575 Tr A(矩阵快速幂)
A为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973。Input数据的第一行是一个T,表示有T组数据。每组数据的第一行有n(2 <= n <= 10)和k(2 <= k < 10^9)两个数据。接下来有n行,每行有n个数据,每个数据的范围是[0,9],表示方阵A的内容。Output对应每组数据,输出Tr(A^k...原创 2019-10-09 18:38:43 · 142 阅读 · 0 评论 -
HDU6186 CS Course(前缀和+后缀和)
Little A has come to college and majored in Computer and Science.Today he has learned bit-operations in Algorithm Lessons, and he got a problem as homework.Here is the problem:You are giving n n...原创 2019-10-09 19:24:58 · 310 阅读 · 0 评论 -
HDU2553N皇后问题(DFS模板问题)
在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。Sample I...原创 2019-10-10 20:18:15 · 130 阅读 · 0 评论 -
HDU1010Tempter of the Bone (深搜+剪枝模板题)
The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone ...原创 2019-10-11 20:29:09 · 175 阅读 · 0 评论 -
HDU3835
We know that some positive integer x can be expressed as x=A^2+B^2(A,B are integers). Take x=10 for example,10=(-3)^2+1^2.We define R(N) (N is positive) to be the total number of variable presenta...原创 2019-09-04 23:43:47 · 82 阅读 · 0 评论