2013 ACM/ICPC 杭州邀请赛(8.5)

A。dp

但是m次数太多,开不出那么大的数组,所以要用算完的值替代新的值,这样来回循环,滚动数组,我用的方法比较麻烦,看到有%2的,也有^1的

我写的是每一次从0到n循环一边,能到的话概率相加

还有一种思路是当前的概率至与上一次的概率有关,每一次都是dp[i][j] = dp[i-1][ (j-x+n)%n ] + dp[i][  (j+x)%n ]

I题就是硬暴,开始想用dfs,发现不对,后来改bfs,都是想麻烦了,四重循环50的4次方,不会超时

看到有降了复杂度的方法,开始把H,P堆到vector中,堆得顺序就是按照题目要求的顺序,然后便利两个vector,求最小距离

J提开始自己想的交,一直wrong,做不对可以换种方式,尽量不要用偏方法

补提:

没补出来

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-10-05 22:24:51

2013 ACM/ICPC 杭州邀请赛(8.5)的相关文章

hduoj 4710 Balls Rearrangement 2013 ACM/ICPC Asia Regional Online —— Warmup

http://acm.hdu.edu.cn/showproblem.php?pid=4710 Balls Rearrangement Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 735    Accepted Submission(s): 305 Problem Description Bob has N balls and A b

hduoj 4708 Rotation Lock Puzzle 2013 ACM/ICPC Asia Regional Online —— Warmup

http://acm.hdu.edu.cn/showproblem.php?pid=4708 Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Alice was felling into a cave. She found a strange door with a number square m

2013 ACM/ICPC Asia Regional Chengdu Online

题目链接: 2013 ACM/ICPC Asia Regional Chengdu Online 上年网选被虐得好惨,遂决定把题目拿回来搞一遍, 不会的题补之! A. 2013 ACM/ICPC Asia Regional Chengdu Online,布布扣,bubuko.com

2013 ACM/ICPC 长沙现场赛 A题 - Alice's Print Service (ZOJ 3726)

Alice's Print Service Time Limit: 2 Seconds      Memory Limit: 65536 KB Alice is providing print service, while the pricing doesn't seem to be reasonable, so people using her print service found some tricks to save money. For example, the price when

hduoj 4706 Herding 2013 ACM/ICPC Asia Regional Online —— Warmup

hduoj 4706 Children's Day 2013 ACM/ICPC Asia Regional Online —— Warmup Herding Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2005    Accepted Submission(s): 563 Problem Description Little Joh

hduoj 4706 Children's Day 2013 ACM/ICPC Asia Regional Online —— Warmup

http://acm.hdu.edu.cn/showproblem.php?pid=4706 Children's Day Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others) Problem Description Today is Children's Day. Some children ask you to output a big letter 'N'. 'N' is c

hduoj 4712 Hamming Distance 2013 ACM/ICPC Asia Regional Online —— Warmup

http://acm.hdu.edu.cn/showproblem.php?pid=4712 Hamming Distance Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 1610    Accepted Submission(s): 630 Problem Description (From wikipedia) For bina

hduoj 4707 Pet 2013 ACM/ICPC Asia Regional Online —— Warmup

http://acm.hdu.edu.cn/showproblem.php?pid=4707 Pet Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description One day, Lin Ji wake up in the morning and found that his pethamster escaped. He searched in th

2017 ACM/ICPC 广西邀请赛 题解

题目链接  Problems HDOJ上的题目顺序可能和现场比赛的题目顺序不一样, 我这里的是按照HDOJ的题目顺序来写的. Problem 1001 签到 #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i(a); i <= (b); ++i) typedef long long LL; LL n, f[31]; int ans; int main(){ f[1] = 1LL; fo