自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(58)
  • 收藏
  • 关注

原创 汽车加油问题

问题描述:一辆汽车加满油后可行驶nkm,旅途中有若干加油站,设计一个有效算法,指出应在哪些加油站停靠加油,使沿途加油次数最少数据输入:n:表示汽车加满油后可行驶nkm    k:旅途中有k个加油站       k+1个整数:表示第k个加油站与第k-1个加油站之间的距离,第0个加油站表示出发地,汽车已加满油。第k+1个加油站表示目的地数据输出:最少加油次数和具体在那几个地方加油#in

2017-10-20 16:39:32 448

原创 区间相交问题

问题描述:给定x轴上n个闭区间。去掉尽可能少的闭区间,使剩下的闭区间都不相交。数据输入:第一行是正整数,编程计算去掉的最少闭区间数数据输出:计算出去掉最小的闭区间数#include using namespace std;struct point{ int a,b;}data[1005];int cmp(point aa,point bb){ return

2017-10-20 16:19:36 448

原创 最优服务次序问题

问题描述:设有n个顾客同时等待一项服务。顾客i需要的服务时间为tj,1输入:第一行是整数n,表示有n个顾客,接下来一行中,有n个正整数,表示n个顾客需要的服务时间输出:计算出最小的平均等待时间#include using namespace std;int main(){ int n; int a[10005]; while(cin>>n) {

2017-10-20 15:41:21 648

原创 数字三角形问题

问题描述:给定一个由n行数字组成的数字三角形,如下图所示                                           7                                 3                    8                         8               1                    0 

2017-10-13 16:20:14 364

原创 Isabella's Message (2011icpc成都站I题)hdu4119

题目:点击打开链接题意:一个矩阵每个格子有一个字母或者空格,现在有一个Mask旋转四次一定能覆盖所有的空格且不重复。然后Mask初始有四种不同的情况所以会产生四句话。要求输出所有单词都在字典里的那句话,如有多句则输出字典序最小的。解题思路:由于当时重现赛的时候没有看到只有四个露出的,所以,就代码写的很长,我用的就是完全的暴力 ,仔细看看还是很容易的#include using na

2017-10-03 16:38:28 336

原创 Hou Yi's secret(hdu4082——2011icpc北京站B题)

题目:点击打开链接题意:给你n个点,问你组成的相似三角形的个数最多是多少分析:直接暴力,很坑的是,这里面有重复的点,还要考虑能否组成三角形#include using namespace std;typedef long long ll;struct point{ ll x,y;} p[20];struct sanjiao{ ll a,b,c;} s[10

2017-10-02 15:52:52 312

原创 Difference (hdu5936——2016ccpc杭州站D题)

题目:点击打开链接题意:(y每位上的数字的K次幂之和)  X=f(y,K)-y。现在给定X和K,求有多少Y满足题意。解题思路:我们大概粗略的计算y应该不超过十位,可以用笔试试,设y = a + b*(1e5);a,b就是都为5位,然后x = f(a,k) - a + f(b,k) - b*(1e5)x - f(a,k) + a = f(b,k) - b*

2017-10-02 11:47:43 411

原创 Recursive sequence——(hdu5950)_(矩阵快速幂)

题目:点击打开链接题意:F(1)=a,F(2)=b,F(N)=2F(N-2)+F(N-1)+N^4给你N,a,b(N,a,b 求F(N)%2147493647分析:如果递推式是F(N)=2F(N-2)+F(N-1)就方便了许多,基本的矩阵快速幂但是多了n^4;这时,又产生了i^3,i^2,i这些新项

2017-09-28 10:50:13 290

原创 循环赛制日程表

这个同样是算法课的作业,利用分治的思想,这个书上还是很简单,并且有模板,#include using namespace std;const int N=1000;int array[N][N]; void table(int k,int array[][N])//数组下标从1开始 { int i,j,s,t; int n=1; for(i=1;i<=

2017-09-19 16:07:08 583

原创 最接近点对距离

算法课的题目,平面有n个点,计算所有点中距离最近的两个点的距离可以把函数当成模板;具体分析过程相信书上也写的很明白了;#include using namespace std;#define maxn 100005int mpt[maxn];struct Point{ double x,y;} p[maxn];int cmpx(Point a,Point b){

2017-09-19 15:48:16 495

原创 Rotate (hdu4998) 几何

题目:点击打开链接题意:一共T组数据,给出n,代表再输入n行,每行x,y代表坐标,P代表这个坐标围绕这个点逆时针旋转P弧度,最后求出一个点和弧度能完成以上效果;解题思路:其实旋转角度就是总旋转角度对2π取余,然后随意找两个启始点,求出按照题目意思旋转后的终点,这两个终点分别都是到两个启始点距离相等,然后解出方程,我就是以(0.0)(1.1)为启始点解的方程#include usin

2017-09-07 13:09:00 187

原创 Battlestation Operational(hdu6134 莫比乌斯反演)

题目:点击打开链接题意:f(n) = sigma[1sigma代表求和符号,celi代表除完向上取整;解题:个人觉得这个代码还挺容易看懂的点击打开链接#include using namespace std;typedef long long ll;const ll mod=1e9+7;const ll maxn=1e6+5;int mu[maxn],prime

2017-08-23 16:23:50 262

原创 Hard challenge(hdu6127)

题目:点击打开链接题意:给出n个点,每个点有自己的权值,两点之间的连线的权值就是两个点的乘积,然后找到经过原点的一条直线,是其能通过的线的值最大,输出这能通过的最大值,题解:先进行极角排序,然后逆时针加减计算,#include using namespace std;const double eps=1e-8;const double PI=acos(-1);typedef

2017-08-21 15:36:28 217

原创 Hybrid Crystals(hdu6140)

题目:点击打开链接题意:就是给定一个序列。序列的每个值都有属性,N代表可加可减,L代表只能加,D代表只能减,当然这些都可以用或者不用。给定一个k,问k是否可能用这个序列构成。解题思路:就是分别向两边扩展区间,看是否在这个区间里,真的是,这是什么题,真的坑,!!!!!#include using namespace std;int main(){ int a[1005]

2017-08-21 13:33:35 228

原创 Killer Names(hdu 6143)

题目:点击打开链接题意:一个人的名字有名和姓,名和姓上各有n个字符位置,每个位置的字符从m个字符里面选择。问你有多少个人的名字其名和姓上没有相同的字符解题思路:点击打开链接   这个解释的还是很好的额#include #include #include using namespace std;typedef long long ll;const ll mod=1e9+7;l

2017-08-18 14:01:58 241

转载 Just do it————(多校第7场 hdu6129)

题目:点击打开链接题意:给出一个长度为n的数列,给出m,像这样b[i]=a[1]^a[2]^…..^a[i],m次,就是b[i]等于A数列从a[1]一直异或到a[i]m次 得到b数列,求出这个数列;解题思路:其实这是一个找规律的问题,,通过这个就发现这是杨辉三角问题,也找到了对应项,如果组合数是奇数就是贡献了一次,如果是偶数就可以看成贡献0次,一直就这么算就对了,然后判断组合数

2017-08-18 12:46:05 287

原创 Mindis(hdu6097)

Problem DescriptionThe center coordinate of the circle C is O, the coordinate of O is (0,0) , and the radius is r.P and Q are two points not outside the circle, and PO = QO.You need to find a po

2017-08-12 13:56:21 225

原创 The Balance (hdu1709) 母函数

Problem DescriptionNow you are asked to measure a dose of medicine with a balance and a number of weights. Certainly it is not always achievable. So you should find out the qualities which cannot be

2017-08-09 15:06:28 249

原创 Crisis of HDU(hdu2110)母函数

Problem Description话说上回讲到HDU大战东洋小苟,结果自然是中方大胜,这一战也使得海东集团在全球同行业中的地位更加巩固。随着集团的发展,很多创业时期的元老逐步功成身退,先是8600移民海外,然后是linle夫妇退隐山林,逐渐的,最初众多的元老只剩下XHD夫妇和Wiskey三人了。到了2020年,因为扩张过度加上老鼠数量逐年减少,公司的发展遇到了前所未有的危机,此时集团已

2017-08-09 14:18:52 232

原创 Holding Bin-Laden Captive!(hdu1085)——母函数

Problem DescriptionWe all know that Bin-Laden is a notorious terrorist, and he has disappeared for a long time. But recently, it is reported that he hides in Hang Zhou of China!“Oh, God! How ter

2017-08-09 14:02:11 229

原创 Square Coins (hdu1398)

Problem DescriptionPeople in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e.,

2017-08-09 13:30:08 191

原创 Rikka with Subset(hdu6092)

Problem DescriptionAs we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:Yuta has n positive A1−An and

2017-08-09 12:51:45 262

原创 Being a Good Boy in Spring Festival (hdu1850)

Problem Description一年在外 父母时刻牵挂春节回家 你能做几天好孩子吗寒假里尝试做做下面的事情吧陪妈妈逛一次菜场悄悄给爸爸买个小礼物主动地 强烈地 要求洗一次碗某一天早起 给爸妈用心地做回早餐如果愿意 你还可以和爸妈说咱们玩个小游戏吧 ACM课上学的呢~下面是一个二人小游戏:桌子上有M堆扑克牌;每堆牌的数量分别为Ni(i=1…M

2017-08-07 14:47:07 210

原创 取石子游戏(hdu1527)

Problem Description有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。 Input输入包含若干行,表示若干种石子的初

2017-08-07 14:12:29 220

原创 Public Sale(hdu2149)巴什博弈

Problem Description虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金。现在等待他的,就是像FarmJohn一样的农田生涯。要种田得有田才行,Lele听说街上正在举行一场别开生面的拍卖会,拍卖的物品正好就是一块20亩的田地。于是,Lele带上他的全部积蓄,冲往拍卖会。后来发现,整个拍卖会只有Lele和他的死对头Yueyue。

2017-08-07 13:37:15 247 1

原创 kiki's game(hdu2147)

Problem DescriptionRecently kiki has nothing to do. While she is bored, an idea appears in his mind, she just playes the checkerboard game.The size of the chesserboard is n*m.First of all, a coin is

2017-08-07 13:21:17 223

原创 World Cup __(UVALive - 7147)

题目大意:n个人互相pk,每个人都要和n-1个人pk,赢了得a分,平了得b分,输了得c分,给出一个m,让你求出排名第(m+1)个人得最高得分以及第m个人得最低得分;解题思路:首先将n个人分为m,1,(n-m-1),然后要求出这个人得最高得分,首先按照我们正常的思维,如果a是同样的道理#include #include using namespace std;typedef lo

2017-08-07 12:07:49 265

原创 Counting Divisors(hdu6069)

Problem DescriptionIn mathematics, the function d(n) denotes the number of divisors of positive integer n.For example, d(12)=6 because 1,2,3,4,6,12 are all 12's divisors.In this

2017-08-04 13:14:27 196

原创 Kanade's sum(hdu 6058)

Problem DescriptionGive you an array A[1..n]of length n.Let f(l,r,k) be the k-th largest element of A[l..r].Specially , f(l,r,k)=0 if r−l+1k.Give you k , you need to calculate

2017-08-04 11:44:33 222

原创 Signal Interference -(hdu5130)

Two countries A-Land and B-Land are at war. The territory of A-Land is a simple polygon with no more than 500 vertices. For military use, A-Land constructed a radio tower (also written as A), and it's

2017-07-31 10:58:18 410

原创 Funny Function————(hdu6050)矩阵快速幂

Problem DescriptionFunction Fx,ysatisfies:For given integers N and M,calculate Fm,1 modulo 1e9+7. InputThere is one integer T in the first line.The next T lines,each line

2017-07-29 17:45:46 334

原创 TrickGCD————(hdu6053)2017多校(莫比乌斯容斥)

Problem DescriptionYou are given an array A , and Zhu wants to know there are how many different array B satisfy the following conditions?* 1≤Bi≤Ai* For each pair( l , r ) (1≤l≤r≤n) , 

2017-07-29 10:59:12 295

原创 Intersection (hdu-5120)

Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know. A ring is a 2-D figure bounded by two circl

2017-06-28 16:37:25 223

原创 Collision (hdu-5114)

Matt is playing a naive computer game with his deeply loved pure girl. The playground is a rectangle with walls around. Two balls are put in different positions inside the rectangle. The balls are

2017-06-28 16:32:47 354

原创 An Easy Physics Problem (hdu5572) 2015ACM/ICPC亚洲区上海站

On an infinite smooth table, there's a big round fixed cylinder and a little ball whose volume can be ignored. Currently the ball stands still at point AA, then we'll give it an initial speed an

2017-06-22 16:17:39 283

原创 Game of Flying Circus --(hdu5515)

The discovery of anti-gravitations technology changed the world. The invention of anti-gravitation shoes (Grav-shoes) enables people to fly in the sky freely. This led to the rise of a new sky sport: 

2017-06-16 09:50:20 546

原创 Frogs (hdu5514)——2015ACM/ICPC亚洲区沈阳站(容斥定理)

There are mm stones lying on a circle, and nn frogs are jumping over them. The stones are numbered from 00 to m−1m−1 and the frogs are numbered from 11 to nn. Theii-th frog can jump over e

2017-06-12 22:11:29 461

原创 Pagodas --(hdu5512)2015ACM/ICPC亚洲区沈阳站

nn pagodas were standing erect in Hong Jue Si between the Niushou Mountain and the Yuntai Mountain, labelled from 11 to nn. However, only two of them (labelled aa and bb, where 1≤a≠b≤n1≤a≠b≤n)

2017-06-12 22:07:40 328

原创 Unknown Treasure ————(hdu5446) 中国剩余定理+卢卡斯定理

On the way to the next secret treasure hiding place, the mathematician discovered a cave unknown to the map. The mathematician entered the cave because it is there. Somewhere deep in the cave, she fou

2017-06-08 20:44:49 260

原创 Game of Taking Stones (hdu5973)——2016大连现场赛C题 威佐夫博弈

Two people face two piles of stones and make a game. They take turns to take stones. As game rules, there are two different methods of taking stones: One scheme is that you can take any number of ston

2017-06-04 19:21:26 710

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除