思路: 动态规划+转移方程效率优化。 实现: 1 class Solution 2 { 3 public: 4 int stoneGameVIII(vector<int>& stones) 5 { 6 int n = stones.size(), sum = 0; 7 for (int i = 0; ...
分类:
其他好文 时间:
2021-06-02 15:41:54
阅读次数:
0
https://leetcode-cn.com/problems/frog-jump/ 思路: 待补充 class Solution { private Boolean[][] rec; public boolean canCross(int[] stones) { int n = stones.l ...
分类:
其他好文 时间:
2021-04-30 12:33:41
阅读次数:
0
【JavaScript】Leetcode每日一题-青蛙过河 【题目描述】 一只青蛙想要过河。 假定河流被等分为若干个单元格,并且在每一个单元格内都有可能放有一块石子(也有可能没有)。 青蛙可以跳上石子,但是不可以跳入水中。 给你石子的位置列表 stones(用单元格序号 升序 表示), 请判定青蛙能 ...
分类:
编程语言 时间:
2021-04-30 12:26:12
阅读次数:
0
Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of sto ...
分类:
其他好文 时间:
2021-04-10 13:23:44
阅读次数:
0
We have a collection of stones, each stone?has a positive integer weight. Each turn, we choose the two?heaviest?stones?and smash them together. Suppos ...
分类:
其他好文 时间:
2021-03-02 12:02:57
阅读次数:
0
Game of Taking Stones HDU - 5973 题目大意 给你两堆石子,分别有$x$,$y$个,可以同时在两堆里取相同个数,也可以只在一堆里取不小于$1$个的石子。 \(x,y<10^{100}\) 解 首先,不考虑数据范围,这是个经典的威佐夫博弈,先手输只需满足如下式子即可: \ ...
分类:
其他好文 时间:
2021-02-01 11:37:37
阅读次数:
0
package LeetCode_771 /** * 771. Jewels and Stones * https://leetcode.com/problems/jewels-and-stones/ * You're given strings J representing the types o ...
分类:
其他好文 时间:
2020-12-05 10:48:43
阅读次数:
7
Magic Stones 题解:here 每一次变换都会导致差分数组的两个相邻元素位置交换,但是大小是不变的; 要保证两个数组相等,所有的差分数组都是要一样的,包括第一个,也就是第一个数要相等 这里第一个数和最后一个数是不变的,所以题目正解为:比较这两个差分数组是否相同,如果相同,再看c数组和t数组 ...
分类:
其他好文 时间:
2020-07-26 23:03:30
阅读次数:
71
Stones Alice and the List of Presents Labs Alice and the Doll Alice and the Unfair Game A、Stones 题意: 给出三种石头分别$a$,$b$,$c$个,每次拿石头的时候只能拿$1$个第一种石头和$2$个第二种 ...
分类:
其他好文 时间:
2020-07-08 13:08:46
阅读次数:
53
"Link" 题意: 有 $a,b,c$ 三堆石头,现在有个操作 操作一:从 $a$ 中拿一块石头,从 $b$ 中拿两块石头 操作二:从 $b$ 中拿一块石头,从 $c$ 中拿两块石头 问最多拿几块石头 思路: 贪心 两种操作收益都是 $3$ 且都会消耗 $b$ 操作 $2$ 对 $b$ 消耗较小 ...
分类:
其他好文 时间:
2020-03-02 23:00:16
阅读次数:
68