题目标签:Greedy 利用priority queue, 把石头重量都存入 pq, 每次取最大两个比较,存入差值,直到pq 只剩最后一个。 Java Solution: Runtime: 1 ms, faster than 92.5% Memory Usage: 37.1 MB, less tha ...
分类:
其他好文 时间:
2020-02-15 09:16:54
阅读次数:
103
Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but ...
分类:
其他好文 时间:
2020-02-15 00:13:57
阅读次数:
103
双下标法找最长公共子序列(不能删除字符) #include<bits/stdc++.h> using namespace std; const int maxn=1014; string s; string t; int main () { cin>>s>>t; int maxLength=0; i ...
分类:
其他好文 时间:
2020-02-13 12:57:55
阅读次数:
54
Given a string S of lowercase letters, a duplicate removal consists of choosing two adjacent and equal letters, and removing them. We repeatedly make ...
分类:
其他好文 时间:
2020-02-07 10:42:50
阅读次数:
74
Given a binary tree . Split the binary tree into two subtrees by removing 1 edge such that the product of the sums of the subtrees are maximized. Sinc ...
分类:
其他好文 时间:
2020-02-02 15:59:08
阅读次数:
110
We have a collection of rocks, each rock has a positive integer weight. Each turn, we choose the two heaviest rocks and smash them together. Suppose t ...
分类:
其他好文 时间:
2020-01-31 14:13:17
阅读次数:
78
https://codeforces.com/contest/1191/problem/D 题意:n堆石子,谁最后没有石子可取谁输,谁取完之后存在两堆相等的石子数谁输。 分情况: 1、只有一堆石子只需判断奇偶。 2、多于两堆:先手输:存在两堆相等数超过两对、存在三堆相等、存在两个0堆、只存在一对两堆 ...
分类:
其他好文 时间:
2020-01-29 17:38:04
阅读次数:
56
第10天 无法割舍的数组 目标:为Stone语言添加简单的数组功能,下标(index)只能使用整数值。 10.1扩展语法分析器 代码清单10.1 与数组相关的语法规则 代码清单10.2 ArrayParser.java 代码清单10.3 ArrayLiteral.java 接下来我们根据新的语法规则 ...
分类:
编程语言 时间:
2020-01-22 21:32:07
阅读次数:
101
Sterilization is the process of removing microorganisms and spores that may be present in an object to prevent infection. China Dental instruments tha ...
分类:
其他好文 时间:
2020-01-22 17:56:41
阅读次数:
98
题目链接 https://atcoder.jp/contests/agc033/tasks/agc033_c 题解 终于会做点最简单的博弈论了…… 首先题目中操作的含义就是选定一个点,把所有不是这个点的叶子删掉(如果这个点不是叶子就删所有叶子)。 对于任何一棵点数不少于$3$的树,一定存在一个点(比 ...
分类:
其他好文 时间:
2020-01-22 11:16:11
阅读次数:
99