自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 快速幂与矩阵快速幂学习笔记

首先附上我学习快速幂的链接https://blog.csdn.net/qq_19782019/article/details/85621386并从中摘抄了一些有用的东西记录下来作为总结1.“取模”运算法则1. ( a + b ) % c = ( ( a % c ) + ( b % c ) ) % c2. ( a * b ) % c = ( ( a % c ) * ( b % c )...

2019-12-06 13:42:16 216 1

原创 I NEED A OFFER!——HDU - 1203(动态规划)

Speakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了。要申请国外的任何大学,你都要交纳一定的申请费用,这可是很惊人的。Speakless没有多少钱,总共只攒了n万美元。他将在m个学校中选择若干的(当然要在他的经济承受范围内)。每个学校都有不同的申请费用a(万美元),并且Speakless估计了他得到这个学校offer的可能性b。不同学校之...

2019-11-26 21:22:24 102

原创 Fibonacci(矩阵快速幂入门)

DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …An...

2019-11-20 20:07:58 319

原创 G - Balanced Lineup POJ - 3264(简单线段树)

For the daily milking, Farmer John’s N cows (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 19:18:44 114

原创 D - Wave HDU - 6570(暴力模拟 / 简单dp)

Avin is studying series. A series is called “wave” if the following conditions are satisfied:It contains at least two elements;All elements at odd positions are the same;All elements at even posit...

2019-11-18 19:48:34 271

原创 M - 昂贵的聘礼(SPFA)

年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:“嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。“探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者替他弄来其他的东西,...

2019-10-30 20:02:11 72

原创 D - 饭卡(背包变形)

电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。Input多组数据。对于每组数据:第一行为正整数n,表示菜的...

2019-10-30 19:41:28 123

原创 G - 钱币兑换问题(物品可以多次选择)

在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法。请你编程序计算出共有多少种兑法。Input每行只有一个正整数N,N小于32768。Output对应每个输入,输出兑换方法数。Sample Input293412553Sample Output71883113137761思路:有1,2,3三个硬币,可以重复选择,对于任意n,放1硬币的最优情况永远是一种,然后对于...

2019-10-30 18:51:28 243

原创 A - Charm Bracelet(DP—标准背包问题)

题意:有n个物品,每个物品有一个权值和评级,每个物品使用一次,有一个权重为m的手镯,现在要向手镯里放物品,请求出不超过权重m的最大评级总和思路:标准的背包模板,依次放入第1~n个物品并更新1到n层,让每层的每个权值都为放入第i个物品时的最大评级总和,在此使用滚动数组的方法替代二维数组进行更新AC代码#include"stdio.h"#include"math.h"#include"alg...

2019-10-30 18:23:45 233

原创 H - Cow Contest POJ - 3660(floyd)

有n(1<=n<=100)个学生参加编程比赛。给出m条实力信息。(1<=M<=4500)其中每一条的格式为 A B (1<=A<=N,1<=B<=N,A!=B) 意思是A的实力比B强。如果A比B强且B比C强,那么A一定比C强。问最后有多少名学生可以确定他的排名。保证输入信息不存在矛盾Input第一行n和m。以下m行 A B 表示A实力...

2019-09-20 17:44:17 88

原创 E - Currency Exchange POJ - 1860(SPFA算法初次使用)

我们的城市有几个货币兑换点。让我们假设每一个点都只能兑换专门的两种货币。可以有几个点,专门从事相同货币兑换。每个点都有自己的汇率,外汇汇率的A到B是B的数量你1A。同时各交换点有一些佣金,你要为你的交换操作的总和。在来源货币中总是收取佣金。例如,如果你想换100美元到俄罗斯卢布兑换点,那里的汇率是29.75,而佣金是0.39,你会得到(100 - 0.39)×29.75=2963.3975卢布。...

2019-09-19 16:26:52 163

原创 H - Fire!(bfs)

Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help Joe escape the maze. Given Joe’s location in the maze...

2019-09-10 18:41:11 141

原创 B - Dungeon Master(广搜-ps:调用结构体比较超时)

[NWUACM]你被困在一个三维的空间中,现在要寻找最短路径逃生!空间由立方体单位构成你每次向上下前后左右移动一个单位需要一分钟你不能对角线移动并且四周封闭是否存在逃出生天的可能性?如果存在,则需要多少时间?Input - 输入  输入第一行是一个数表示空间的数量。每个空间的描述的第一行为L,R和C(皆不超过30)。L表示空间的高度。R和C分别表示每层空间的行与列的大小。随后L层...

2019-09-05 17:05:24 121 1

原创 A - 棋盘问题(深搜)

在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <=...

2019-09-04 20:07:47 166

原创 N - Building Block HDU - 2818(带权并查集)

John are playing with blocks. There are N blocks (1 <= N <= 30000) numbered 1…N。Initially, there are N piles, and each pile contains one block. Then John do some operations P times (1 <= P &l...

2019-09-02 20:21:56 114

原创 J - Farm Irrigation HDU - 1198(并查集)

Benny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes are placed in these squares. Different square has a different type of ...

2019-08-28 20:32:25 143

原创 F - Shooshuns and Sequence CodeForces - 222A

One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps:Find the number that goes k-th in the c...

2019-08-22 09:51:50 258

原创 B - Simple Molecules CodeForces - 344B

Mad scientist Mike is busy carrying out experiments in chemistry. Today he will attempt to join three atoms into one molecule.A molecule consists of atoms, with some pairs of atoms connected by atomi...

2019-08-22 09:18:47 129

原创 A - Books CodeForces - 279B

When Valera has got some free time, he goes to the library to read some books. Today he’s got t free minutes to read. That’s why Valera took n books in the library and for each book he estimated the t...

2019-08-19 09:36:37 223

原创 C - Jzzhu and Sequences

Jzzhu has invented a kind of sequences, they meet the following property:You are given x and y, please calculate fn modulo 1000000007 (109 + 7).InputThe first line contains two integers x and y (|x...

2019-08-09 18:00:33 141

原创 C - Catch That Cow

农夫知道一头牛的位置,想要抓住它。农夫和牛都于数轴上 ,农夫起始位于点 N(0<=N<=100000) ,牛位于点 K(0<=K<=100000) 。农夫有两种移动方式:1、从 X移动到 X-1或X+1 ,每次移动花费一分钟2、从 X移动到 2*X ,每次移动花费一分钟假设牛没有意识到农夫的行动,站在原地不动。最少要花多少时间才能抓住牛?Input一行: 以空...

2019-08-08 18:18:23 191

原创 B - Valuable Resources

B - Valuable ResourcesMany computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems.Let’s suppose that yo...

2019-08-07 17:33:41 252

原创 E - What Is Your Grade?

“Point, point, life of student!”This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used ...

2019-05-14 11:43:29 211

空空如也

空空如也

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

TA关注的人

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