ICode9

精准搜索请尝试: 精确搜索
  • | dp-the Treasure Hunter2019-04-29 16:53:40

    题目: A. Mr. Kitayuta, the Treasure Hunter time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The Shuseki Islands are an archipelago of 30001 small islands in the Yutampo Sea. The islands

  • codeforces510D2019-04-27 22:52:00

    Fox And Jumping  CodeForces - 510D  Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0. There are also n cards, each card has

  • SP913 QTREE2 - Query on a tree II2019-04-25 14:53:41

    思路 第一个可以倍增,第二个讨论在a到lca的路径上还是lca到b的路径上, 倍增即可 代码 #include <cstdio> #include <algorithm> #include <cstring> using namespace std; int jump[10010][16],sum[10010][16],fir[10010],nxt[10010*2],v[10010*2],w[10010*2],cnt,dep[10010],n; void

  • leetcode 55. 跳跃游戏(Jump Game)2019-04-22 11:39:19

    目录 题目描述: 示例 1: 示例 2: 解法: 题目描述: 给定一个非负整数数组,你最初位于数组的第一个位置。 数组中的每个元素代表你在该位置可以跳跃的最大长度。 判断你是否能够到达最后一个位置。 示例 1: 输入: [2,3,1,1,4] 输出: true 解释: 从位置 0 到 1 跳 1 步, 然后跳 3 步

  • 剑指offer:变态跳台阶2019-03-24 11:49:50

    题目描述: 一只青蛙一次可以跳上1级台阶,也可以跳上2级……它也可以跳上n级。求该青蛙跳上一个n级的台阶总共有多少种跳法。   解题思路: 和之前跳台阶问题相比,这道题就是将跳台阶的类型增加到了n。实际上对于f(n)来说,总的跳台阶数目就是前n-1的总和加上当前的1。用F(n)表示所有从1,2.

  • 剑指offer :跳台阶2019-03-23 20:47:55

    这题之前刷leetcode也遇到过,感觉是跟斐波拉契差不多的题。 题目描述: 一只青蛙一次可以跳上1级台阶,也可以跳上2级。求该青蛙跳上一个n级的台阶总共有多少种跳法(先后次序不同算不同的结果)。   解题思路: 这类题一般就是用递归思想,先考虑跳一级台阶情况,再是两级。发现由于跳台阶的选择

  • Jump Game - LeetCode2019-02-24 20:51:21

    目录 题目链接 注意点 解法 小结 题目链接 Jump Game - LeetCode 注意点 解法 解法一:贪心算法,只关注能到达最远距离,如果能到达的最远距离大于结尾说明能到达,否则不能。并且如果i超过了能到达的最大距离说明不能到达,因为i是每次加一都能超过最大距离,小于i的所有位置都会走

  • JUMP INtO 3D WORLD2019-02-23 16:41:01

    There is a simple way to play with 3D stuff ---- WebGL! We can have cool 3D in every modern web browser, in your brother's new android phone, or your old linux computer, the WebGL magic can work.   Honestly, I have nothing know about 3D, need learnin

  • [Lintcode]116. Jump Game/[Leetcode]55. Jump Game2019-02-10 21:44:09

    116. Jump Game/55. Jump Game 本题难度: Medium Topic: Greedy Description Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. De

  • 19.2.8 [LeetCode 55] Jump Game2019-02-08 17:47:50

    Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index. Example 1: Input: [2,

  • 55. Jump Game2019-02-08 12:38:07

    Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index. Example 1: Input: [2,

  • River Hopscotch2019-02-08 12:37:44

    题目链接:http://poj.org/problem?id=3258 River Hopscotch Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 22092   Accepted: 9138 Description Every year the cows hold an event featuring a peculiar version of hopscotch that involves ca

  • Leetcode-403 Frog Jump(青蛙过河)2019-02-03 20:53:41

    1 #define pb push_back 2 #define _for(i,a,b) for(int i = (a);i < (b);i ++) 3 class Solution 4 { 5 public: 6 bool canCross(vector<int>& stones) 7 { 8 int sz = stones.size(); 9 if(sz==2&&ston

  • LeetCode 55. Jump Game2019-02-03 10:38:28

        解答: 经典的贪心算法,也就是每一步都求最优解,所有的最优解组合就可以得到整个问题的最优解。这道题关心的是最左边的格子能否到达最右边的格子,我们不妨从右到左来分析,设最右边格子的index为lastPos,如果倒数第二个格子可以到达lastPos,那么更新lastPos为倒数第二个格子的index,以

  • "贪心"的考试2019-01-30 15:41:58

    先来落实比较简单的T3,T4 T3  团结的队伍 team 题目描述 众所周知,长郡信息组是一个团结友爱的优秀团队。为了弘扬团队精神,践行社会主义核心价值观,秉承朴实沉毅的校训,信息组决定外出游玩(。。。。。。)。jump:“你们想怎么玩?”xzy:“要组队一起走。”XYK:“我喜欢 2 个人组一

  • LeetCode-55-Jump Game2019-01-30 09:02:47

    算法描述: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index. Example 1: Inpu

  • CF198B Jumping on Walls (DFS+剪枝)2019-01-29 22:52:39

    今天写了一道题,RE了两次,WA了两次,改了很多遍,最后一遍修改的时候找到了问题; 难度:CF B; 重点:DFS+剪枝   题目 Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon. The canyon consists of two vertical parallel walls, their h

  • Luogu4606 SDOI2018 战略游戏 圆方树、虚树、链并2019-01-19 09:00:48

    传送门 弱化版 考虑到去掉一个点使得存在两个点不连通的形式类似割点,不难想到建立圆方树。那么在圆方树上对于给出的关键点建立虚树之后,我们需要求的就是虚树路径上所有圆点的数量减去关键点的数量。 因为没有DP,所以其实没有必要将虚树建立起来,只需要维护一个链并就可以了。 #incl

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

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

ICode9版权所有