ICode9

精准搜索请尝试: 精确搜索
  • 20.8.24 周赛 5496. 你可以获得的最大硬币数目 中等2020-08-23 12:02:13

    题目 有 3n 堆数目不一的硬币,你和你的朋友们打算按以下方式分硬币: 每一轮中,你将会选出 任意 3 堆硬币(不一定连续)。 Alice 将会取走硬币数量最多的那一堆。 你将会取走硬币数量第二多的那一堆。 Bob 将会取走最后一堆。 重复这个过程,直到没有更多硬币。 给你一个整数数组 piles ,其

  • 877. Stone Game2020-07-24 06:00:19

    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 stones piles[i]. The objective of the game is to end with the most stones.  The total number of stones is

  • LeetCode 875. 爱吃香蕉的珂珂(二分查找)2020-05-25 23:02:10

    1. 题目 珂珂喜欢吃香蕉。这里有 N 堆香蕉,第 i 堆中有 piles[i] 根香蕉。警卫已经离开了,将在 H 小时后回来。 珂珂可以决定她吃香蕉的速度 K (单位:根/小时)。每个小时,她将会选择一堆香蕉,从中吃掉 K 根。 如果这堆香蕉少于 K 根,她将吃掉这堆的所有香蕉,然后这一小时内不会再吃更

  • leetcode之石子游戏(博弈类动态规划)2020-05-25 12:38:08

    这是一道博弈类的动态规划题目,题目假设两者都能发挥出最佳水平,那么这题如果用贪心算法(每次选取最左边和最右边的最大值)其实是不行的,比如[1,100,3];不管先手一开始拿的是最左边的1还是最右边的3,那么后手都能拿到100,后手就会赢。所以这里我们采用动态规划去解决。 思路如下

  • [Agc002E/At1999] Candy Piles - 博弈论2020-02-06 18:07:58

    有n堆石子,第i堆有ai个石子。有两种操作: 把石子最多的那一堆给丢掉 把每一堆全部丢掉一个 谁拿走最后石子谁输。判断胜负情况。 直觉转化为一个走棋盘问题 考虑如何计算左下角点的状态 找到原点最右上方且不在边界上的点 如果这个点和上方、和右方距离有一个是奇数,那么这个点就是后

  • Codeforces Round #557 (Div. 2)E. Thanos Nim2020-01-13 21:56:53

    Alice and Bob are playing a game with nn piles of stones. It is guaranteed that nn is an even number. The ii-th pile has aiai stones. Alice and Bob will play a game alternating turns with Alice going first. On a player's turn, they must choose exactl

  • LeetCode 875. Koko Eating Bananas2019-11-18 09:00:07

    原题链接在这里:https://leetcode.com/problems/koko-eating-bananas/ 题目: Koko loves to eat bananas.  There are N piles of bananas, the i-th pile has piles[i] bananas.  The guards have gone and will come back in H hours. Koko can decide her bananas-per-

  • LeetCode 1140. Stone Game II2019-08-30 11:52:13

    原题链接在这里:https://leetcode.com/problems/stone-game-ii/ 题目: Alex and Lee continue their games with piles of stones.  There are a number of piles arranged in a row, and each pile has a positive integer number of stones piles[i].  The objective of th

  • leetcode 877. 石子游戏2019-08-16 17:56:56

    题目描述: 亚历克斯和李用几堆石子在做游戏。偶数堆石子排成一行,每堆都有正整数颗石子 piles[i] 。 游戏以谁手中的石子最多来决出胜负。石子的总数是奇数,所以没有平局。 亚历克斯和李轮流进行,亚历克斯先开始。 每回合,玩家从行的开始或结束处取走整堆石头。 这种情况一直持续到没

  • Codeforces Round #575 (Div. 3) A - Three Piles of Candies2019-07-30 17:54:04

    Codeforces Round #575 (Div. 3)   A - Three Piles of Candies Alice and Bob have received three big piles of candies as a gift. Now they want to divide these candies as fair as possible. To do this, Alice takes one pile of candies, then Bob takes one of the

  • leetcode 877. 石子游戏(Stone Game)2019-05-07 17:49:16

    目录 题目描述: 示例: 解法: 题目描述: 亚历克斯和李用几堆石子在做游戏。偶数堆石子排成一行,每堆都有正整数颗石子 piles[i] 。 游戏以谁手中的石子最多来决出胜负。石子的总数是奇数,所以没有平局。 亚历克斯和李轮流进行,亚历克斯先开始。 每回合,玩家从行的开始或结束处取走整堆

  • [AT1999] [agc002_e] Candy Piles2019-04-18 11:37:43

    题目链接 AtCoder:https://agc002.contest.atcoder.jp/tasks/agc002_e 洛谷:https://www.luogu.org/problemnew/show/AT1999 Solution 设\(f[i][j]\)表示拿了\(i\)个最大的,全部减一了\(j\)次先手必胜还是必败。 那么把表打出来可以发现它长这样: 无耻的偷大佬的图 发现必胜或必败状态

  • 1000. Minimum Cost to Merge Stones2019-03-28 19:51:20

    There are N piles of stones arranged in a row.  The i-th pile has stones[i] stones. A move consists of merging exactly K consecutive piles into one pile, and the cost of this move is equal to the total number of stones in these K piles. Find the

  • LeetCode-Python-875. 爱吃香蕉的珂珂2019-03-23 22:48:37

    珂珂喜欢吃香蕉。这里有 N 堆香蕉,第 i 堆中有 piles[i] 根香蕉。警卫已经离开了,将在 H 小时后回来。 珂珂可以决定她吃香蕉的速度 K (单位:根/小时)。每个小时,她将会选择一堆香蕉,从中吃掉 K 根。如果这堆香蕉少于 K 根,她将吃掉这堆的所有香蕉,然后这一小时内不会再吃

  • 力扣——石子游戏2019-03-21 22:43:23

    亚历克斯和李用几堆石子在做游戏。偶数堆石子排成一行,每堆都有正整数颗石子 piles[i] 。 游戏以谁手中的石子最多来决出胜负。石子的总数是奇数,所以没有平局。 亚历克斯和李轮流进行,亚历克斯先开始。 每回合,玩家从行的开始或结束处取走整堆石头。 这种情况一直持续到没有更多的石

  • [LeetCode] Minimum Cost to Merge Stones 混合石子的最小花费2019-03-07 23:40:06

    There are N piles of stones arranged in a row.  The i-th pile has stones[i] stones. A move consists of merging exactly K consecutive piles into one pile, and the cost of this move is equal to the total number of stones in these K piles. Find th

  • agc002E - Candy Piles(博弈论)2019-03-05 21:51:17

    题意 题目链接 Sol Orz SovitPower #include<bits/stdc++.h> #define Pair pair<int, double> #define MP(x, y) make_pair(x, y) #define fi first #define se second //#define int long long #define LL long long #define Fin(x) {freopen(#x".in",&qu

  • LeetCode1000.Minimum Cost to Merge Stones(合并石头的最低成本)2019-03-03 12:51:48

    1000.Minimum Cost to Merge Stones(合并石头的最低成本)DescriptionDifficulty: hardExample 1:Example 2:Example 3:Note:分析参考代码 Description There are N piles of stones arranged in a row. The i-th pile has stones[i] stones. A move consists of merging exactly

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有