avatar
fireworks99
keep hungry keep foolish
HDU 1716排列2

Description

现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。

Read more -->
HDU 1231 最大连续子序列

Description

给定K个整数的序列{ N1, N2, …, NK },其任意连续子序列可表示为{ Ni, Ni+1, …, Nj },其中 1 <= i <= j <= K。最大连续子序列是所有连续子序列中元素和最大的一个, 例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{ 11, -4, 13 },最大和 为20。 在今年的数据结构考卷中,要求编写程序得到最大和,现在增加一个要求,即还需要输出该 子序列的第一个和最后一个元素。

Read more -->
HDU 1263 水果

Description

Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表

题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1263

Read more -->
HDU 1075 What are you Talking About

Description

Ignatius is so lucky that he met a Martian yesterday. But he didn’t know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now Ignatius want to translate the history book into English. Can you help him?

Read more -->
超链接测试

这是 百度

baidu

        **<a href="https://fireworks99.github.io/2019/04/10/Gitment-%E8%AF%84%E8%AE%BA/" style="color:violet;">如何参与Gitment评论</a>**
**<a href="网址" style="color:violet;">题目链接</a>**

csdn

https://fireworks99.github.io/

Read more -->
HDU 1969 Pie

Description

My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This should be one piece of one pie, not several small pieces ……

Read more -->
HDU 1010 Tempter of the Bone

奇偶剪枝

若 t-[abs(ex-sx)+abs(ey-sy)] 结果为非偶数(奇数),则无法在t步恰好到达.

Read more -->
乘法逆元

什么是逆元?

设x是a的倒数,那么 x * a = 1(即x = 1 / a).

设x是a的逆元,那么 x * a % p = 1.

Read more -->
HDU 1559 最大子矩阵

Description

给你一个m×n的整数矩阵,在上面找一个x×y的子矩阵,使子矩阵中所有元素的和最大。

Read more -->
HDU 1556 Color the ball(差分)

用差分实现区间操作

一维

给定一个长度为n的数列a,要求支持操作add(L,R,k)表示对a[L]~a[R]的每个数都加上k。并求修改后的序列a。

设原数组为a[i]a[i], 设数组d[i]=a[i]−a[i−1](a[0]=0),则 a[i]=∑ij=1d[j]

更新操作update(s, t, d)把区间A[s]…A[t]都增加d,我们引入一个数组delta[i],表示

A[i]…A[n]的共同增量,n是数组的大小。那么update操作可以转化为:

1)令delta[s] = delta[s] + d,表示将A[s]…A[n]同时增加d,但这样A[t+1]…A[n]就多加了d

2)再令delta[t+1] = delta[t+1] - d,表示将A[t+1]…A[n]同时减d

我们考虑用差分的做法。这里 需要一个辅助数组c,c用来记录某一个位置上的总改变量。c[i]表示的是i~n这些元素都加上c[i]这个数。我们对[L,R]区间进行加值操作,在c[L]处加一个k,在c[R+1]处就减去一个k。最后求序列的每个位置变成了多少,只需要求一下c数组的前缀和,然后和原数组按位相加就好。

Read more -->
Site by Baole Zhao | Powered by Hexo | theme PreciousJoy