摘要:
洛谷地址:https://www.luogu.com.cn/problem/CF909A 来自洛谷的题意: 给定两个用空格分隔的字符串,分别取两字符串的任意非空前缀,将两前缀合并为一个新的字符串,求可行字典序最小的字符串。 解析: 给定s1 s2 已知取两者非空前缀,所以s2只需要取首就可以了。 那 阅读全文
posted @ 2020-07-09 23:40
liyexin
阅读(170)
评论(0)
推荐(0)
摘要:
来自:https://blog.csdn.net/sdau20171989/article/details/79230721?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.none 阅读全文
posted @ 2020-07-09 23:17
liyexin
阅读(247)
评论(0)
推荐(1)
摘要:
地址:https://www.luogu.com.cn/problem/P1208 解析: 单价p,可完成数x 要想保证花费最少,有贪心思路: 1:单价从小到大排列。保证花费最小 2:单价相同,可完成数从大到小排列。保证能尽量多的用花费少的一方。 #include<cstdio> #include< 阅读全文
posted @ 2020-07-09 22:48
liyexin
阅读(205)
评论(0)
推荐(0)
摘要:
地址:https://www.luogu.com.cn/problem/P1090 解析: 要想最后花费最少,肯定每次要加入两个最小值。 所以贪心思路,就是每次取剩余堆的两个最小值相加,相加以后,把它放入队列。 使用优先队列实现: priority_queue<int,vector<int>,gre 阅读全文
posted @ 2020-07-09 18:07
liyexin
阅读(238)
评论(0)
推荐(0)
摘要:
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2570 解析: 想让最后的体积最大,肯定是先加入浓度小的。 所以贪心思路是,浓度从小到大加入。 注意: n种同体积的浓度分别为a,b,c...那么混合以后浓度为:(a+b+c+..)/n 所以从小到大加入即可 阅读全文
posted @ 2020-07-09 17:39
liyexin
阅读(227)
评论(0)
推荐(0)

浙公网安备 33010602011771号