自定义博客皮肤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)
  • 收藏
  • 关注

原创 River Hopscotch(二分+贪心)

River HopscotchEvery year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The excitement takes place on a long, straight...

2020-02-28 20:56:13 303

原创 Expanding Rods(二分法)

Expanding RodsWhen a thin rod of length L is heated n degrees, it expands to a new length L’=(1+n*C)*L, where C is the coefficient of heat expansion.When a thin rod is mounted on two solid walls and...

2020-02-27 21:22:45 571 1

原创 尺取、二分、三分(函数模板)

尺取、二分、三分(函数)一、尺取设置两个下标表示区间的左右端点,根据实际情况推进两个端点求得答案。/** 给定一个序列a,求a中元素和大于等于s的子序列的最小长度 (保证a中元素都为正)*/int take() //尺取{ int l=1,r=1; int sum=a[1],ans=inf; while(r<=n) //s是要查找的元素 ...

2020-02-27 19:57:31 306

原创 Can you solve this equation?(二分法)

Can you solve this equation?Now,given the equation 8x^4 + 7x^3 + 2x^2 + 3x + 6 == Y,can you find its solution between 0 and 100;Now please try your lucky.InputThe first line of the input contains ...

2020-02-27 19:44:25 345

原创 Jessica's Reading Problem(尺取法)

Jessica’s Reading ProblemJessica’s a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she has spent little time on it. If she wants to pass it, she ha...

2020-02-26 20:04:36 357

原创 C++ -STL之map、vector、set

STL之map、vector、setC++的标准模板库(Standard Template Libray,简称STL)是一个容器和算法的类库。容器往往包含同一类型的数据。STL中比较常用的容器是:vector、set和map,比较常用的算法有Sort等。一、vector(数组的代替品)1.声明:一个vector类似于一个动态数组。vector中可以存在重复的元素!vector<i...

2020-02-25 22:13:13 535

原创 233 Matrix(矩阵快速幂)

233 MatrixIn 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 ...

2020-02-23 19:42:11 436

原创 Queuing(矩阵快速幂)

QueuingQueues and Priority Queues are data structures which are known to most computer scientists. The Queue occurs often in our daily life. There are many people lined up at the lunch time.Now we ...

2020-02-23 16:57:50 362

原创 A Simple Math Problem(矩阵快速幂)

A Simple Math ProblemLele now is thinking about a simple function f(x).If x < 10 f(x) = x.If x >= 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 * f(x-10);And ai(0<=i<=9) ...

2020-02-21 20:09:36 406

原创 Recursive sequence(矩阵快速幂)

Recursive sequenceFarmer John likes to play mathematics games with his N cows. Recently, they are attracted by recursive sequences. In each turn, the cows would stand in a line, while John writes two...

2020-02-20 21:52:22 393

原创 Happy Necklace(矩阵快速幂)

Happy NecklaceLittleQ wants to buy a necklace for his girlfriend. Necklaces are single strings composed of multiple red and blue beads.Little Q desperately wants to impress his girlfriend, he knows ...

2020-02-19 20:07:44 306

原创 Tr A(矩阵快速幂)

Tr AA为一个方阵,则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)%...

2020-02-18 20:26:30 734

原创 矩阵快速幂求斐波那契数列

矩阵快速幂求斐波那契数列In 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, …A...

2020-02-18 19:45:14 405

原创 POJ-3414-Pots(BFS)

PotsYou are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;DROP(i) empty the...

2020-02-12 16:34:09 277

原创 C++ map函数

C++中的map函数简单一般的map构造函数:map < string , int > mapstring; map < int , string > mapint;map < sring , char > mapstring; map < char , string > mapchar;map < char , int > ...

2020-02-11 16:34:01 3937

原创 POJ-3087- Shuffle'm Up

Shuffle’m UpA common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips, S1 and S2, each stack containin...

2020-02-11 16:24:30 264

原创 POJ-3126-Prime Path(BFS)

Prime PathThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.— It is a ma...

2020-02-11 10:36:50 279

原创 POJ-1426-Find The Multiple(DFS)

Find The MultipleGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater ...

2020-02-10 17:19:16 361 1

原创 POJ-3278-Catch That Cow(BFS/队列)

Catch That CowFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K...

2020-02-09 17:57:38 261

原创 HDU-1010-Tempter of the Bone(深搜+奇偶剪枝)

Tempter of the Bone翻译:暑假的时候,小明和朋友去迷宫中寻宝。然而,当他拿到宝贝时,迷宫开始剧烈震动,他感到地面正在下沉,他们意识到这是一个陷阱!他们想尽一切办法逃出去。迷宫是一个大小为 N*M 的长方形,迷宫中有一扇门。一开始,门是关着的,他会在第 t 秒的时间打开。因为,小明和朋友必须在第 t 秒到大门口。每一秒,他都可以向上下左右四个方向移动一个点。一旦他移动了,他刚...

2020-02-07 16:38:14 274

原创 函数模板(Function Template)

函数模板(Function Template)所谓函数模板,实际上就是建立一个通用函数1、函数定义时不指定具体的数据类型(使用虚拟类型代替)2、函数被调用时编译器根据实参反推数据类型-类型的参数化//模板头与函数声明/定义永远是不可分割的整体!template<typename 类型参数1,typename 类型参数2,...>//typename老版C++用class返回...

2020-02-06 18:15:12 545

原创 POJ-1028-Web Navigation

Web NavigationStandard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages...

2020-02-04 17:35:11 381

原创 k-rounding

k-roundingFor a given positive integer n denote its k-rounding as the minimum positive integer x, such that x ends with k or more zeros in base 10 and is divisible by n.For example, 4-rounding of 37...

2020-02-04 16:53:10 295

空空如也

空空如也

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

TA关注的人

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