上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 32 下一页
摘要: 地址:http://codeforces.com/contest/1337 题意:给出a,b,c,d。从a~b~c~d三个区间内各找一个数,构成三角形。 解析:根据三角形的性质,输出a,c,c是一个可行解。记得从小到大输出,wa了1次。 #include<iostream> #include<vec 阅读全文
posted @ 2020-04-16 23:50 liyexin 阅读(188) 评论(0) 推荐(0)
摘要: 地址:https://www.luogu.com.cn/problem/CF33C 题意: 给你一个序列,你可以选择它的前缀和后缀中的每个数字都乘以-1。前缀和后缀可以交叉也可以为空。 问能得到的最大序列和是多少。 解析:假设这个序列分成了三部分:A(前缀)+B(重合)+C(后缀) S=A+B+C。 阅读全文
posted @ 2020-04-16 23:06 liyexin 阅读(144) 评论(0) 推荐(0)
摘要: 地址:http://codeforces.com/contest/33/problem/B 很老的题了,今天被学长拉出来,就做做看。 题意:给出两个字符串,给出n个 a b x,表明字符a可以变成b,每次花费为x。问要想把这俩字符串变成一样的,最少花费多少。无法变就输出-1。 解析:刚开始以为,每次 阅读全文
posted @ 2020-04-15 21:53 liyexin 阅读(176) 评论(0) 推荐(0)
摘要: 地址:http://codeforces.com/contest/1335 题意:将n分成a,b。保证a>b,问有几种分法 解析:偶数输出n/2-1,奇数n/2即可 #include<iostream> #include<cstdio> #include<cstring> #include<algo 阅读全文
posted @ 2020-04-14 20:03 liyexin 阅读(203) 评论(0) 推荐(0)
摘要: 地址: https://codeforces.com/contest/1339 解析:最近a题题意都好长啊.....这道题直接看有几个竖着的菱形就可以了,输入n,输出n。 #include<iostream> #include<cstdio> #include<cstring> #include<a 阅读全文
posted @ 2020-04-13 20:33 liyexin 阅读(198) 评论(0) 推荐(0)
摘要: 地址:http://codeforces.com/contest/1334 题意:给出n组同一时间的游戏完成数和消除数。按顺序排列。问是否符合实际。 解析:这个题意挺长,刚开始是有点懵的。根据题意,随着时间流逝,游戏数不会减少,消除数也不会减少(根据样例也能看出)。一个玩家成功完成一次,那么游戏数和 阅读全文
posted @ 2020-04-12 21:25 liyexin 阅读(181) 评论(0) 推荐(0)
摘要: 地址:https://www.acwing.com/problem/content/284/ 题意:给一堆石子,相邻的合并,问最后得到的最小花费,花费具体算法在题里。 解析: 对于此题,根据常识,对于最终状态,是由两团合并的。所以定义dp[i][j]表示区间i-j合并的最小值。 二堆合并:dp[1] 阅读全文
posted @ 2020-04-11 23:44 liyexin 阅读(185) 评论(0) 推荐(0)
摘要: 地址:https://cometoj.com/contest/76/problem/A?problem_id=4237 解析:这个题用DP解比较简单,其他的解法我并没有看懂。所谓波浪,单独一个数字不能算,两个数字一定算上。我们的二维dp,j=0表示下降或相等,j =1 表示上升。i 从0到n 转移方 阅读全文
posted @ 2020-04-11 23:41 liyexin 阅读(168) 评论(0) 推荐(0)
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1087 题意:这个样例很误导人啊,这个题意呢,就是从起点跳到终点,保持递增跳而且得分最大。注意,起点和终点是不计分的; 解析:模板改一下就好了,之前求的是序列长度。这里求和,那么只要把dp初始化a[ ],依然 阅读全文
posted @ 2020-04-11 23:38 liyexin 阅读(203) 评论(0) 推荐(0)
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1257 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; const 阅读全文
posted @ 2020-04-11 23:36 liyexin 阅读(116) 评论(0) 推荐(0)
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 32 下一页