- 博客(9)
- 收藏
- 关注
原创 Bubble Bucket Sort(DP)
Bubble Bucket Sort(DP)题目描述Belinda loves blowing bubbles! After a long day of blowing bubbles,Belinda thinks it would be a good idea to sort the bubbles into buckets to store for the winter.Each bubble must be placed in a bucket and she would like the bu
2021-10-10 22:54:09
229
原创 Jump conveyor(图论)
题目描述Emma is a creative child who got bored during the quarantine season. She set up n trampolines in a line inside the living room, each aimed in a particular direction. The ith trampoline has value vi.When Emma jumps to position i, if there is a trampol
2021-04-14 21:34:23
303
原创 马拉车算法
Manacher 算法 ,用以求解最长回文字符串,其时间复杂度为o(n),这个算法首先最帅的一点在于对奇偶字符串的处理,例如aba和abba,那么仅仅需要在每个字符之间(包括外层)插入一个原字符串没有的字符,一般用“#”或者“$”,此时aba变成了:#a#b#a# 仍是以b为中心的奇数长度回文字符串此时abba变成了:#a#b#b#a#这是其变成了以“#”为中心的奇数长度回文字符串有了以上的处理就可以将奇偶字符串统一拓展为奇数长度字符串进行处理。但是manacher 算法中对字符串的处理还要进行
2021-04-07 22:36:30
309
原创 苹果旅游(DP)
题目描述xiaoT发现山谷相当的大,准确地说应该是相当的长,xiaoT想到山谷的那头去看看,但是靠xiaoT走路的速度,到那边要n年。还好xiaoT可以买一些苹果,它把这些苹果当成动力,根据火箭发射的原理,如果xiaoT把苹果向后扔,xiaoT就会向前进。苹果有两种,一种青苹果,一种红苹果。已知到山谷的长度为k,用一些(同一种类)苹果可以通过的路程为1。苹果的价格是不一样的,红苹果的价格是红苹果个数的四次方。青苹果的价格就是青苹果个数。输入第一行有一个正整数n表示xiaoT走路到那边需要的时间
2021-04-02 22:32:03
1162
1
原创 Payment-ATCODER-155-E(DP)
#payment题目描述In the Kingdom of AtCoder, only banknotes are used as currency. There are 10100+1 kinds of banknotes, with the values of 1,10,102,103,…,10(10^100). You have come shopping at a mall and are now buying a takoyaki machine with a value of N. (Tak
2021-03-10 20:15:16
213
原创 colorf slimes(刷题总结)
#colorful slimes(DP + 思维)题目描述Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are conveniently numbered 1 through N. Snuke currently has no slime. His objective is to have slimes
2021-03-10 07:41:45
512
原创 n*n蛇形方阵的输出
题目描述输入一个正整数 n,生成一个 n×n 的蛇形方阵。输入一行一个正整数 n,1≤n≤20。输出共 n 行,每行 n 个正整数,每个正整数占 5 列。样例输入5样例输出输入的方向跟副对角线平行难点在于每次输入的方向会发生改变但是有耐心足矣下面贴码// An highlighted block#include<stdio.h>#include<string>#include<cstring>int main(){ int n,i
2020-12-09 16:33:09
4088
2
原创 数字螺旋方阵的输出
数字螺旋方阵的输出一个 n 行 n 列的螺旋方阵按如下方法生成:从方阵的左上角(第 1 行第 1 列)出发,初始时向右移动;如果前方是未曾经过的格子,则继续前进;否则,右转。重复上述操作直至经过方阵中所有格子。根据经过顺序,在格子中依次填入 1,2,3,…,n,便构成了一个螺旋方阵。下面是一个 n=4 的螺旋方阵。编程输入一个正整数 n,生成一个 n×n 的螺旋方阵。域宽为5列;具体思路是分层输入// An highlighted block#include<stdio.h>in
2020-12-09 15:39:01
1819
1
原创 大数乘积取模的具体原理实现
垃圾lulu的博客大数乘积取模的原理大数乘积取模的原理大数乘取余:由于p同样很大,导致((a%p)(b%p))%p还是会溢出。举个例子4(13)%p;我们把13转化为二进制数即1101即有4*(1101)(2)%p;即转化为4*(1 *2^3 + 1 *2^2+0 *2^1+1 *2^0)%p;那么问题就转化为4从1101的低位开始不断相乘取模我们只需要每移动一位时将4乘以2即可,当b的最后一位为1时相加实现代码如下// An highlighted block#include<
2020-12-09 14:02:31
1429
3
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅