ICode9

精准搜索请尝试: 精确搜索
  • Mac中的环境变量2020-11-03 23:03:45

    引言 ​ 在安装jdk的时候无脑安装的jdk,居然可以直接的在终端进行编译运行不需要像Windows下重新配置环境变量。因为这个原因我想看看mac的环境变量在哪里是怎么设置的。 (今天同学告诉我,win闭着眼睛好像也能配置)。 Mac中的环境变量 ​ 在mac中设置环境变量需要从文件中修改,win好像

  • CodeForces - 14D Two Paths(两次bfs求树的直径)2020-10-11 18:01:22

    CF14D Two Paths 题目大意: 给定一棵权值为\(1\)的树,从中两条最长的路径且两者没有公共节点,求最大的二路径乘积。 思路: 观察到\(n\)的范围很小,可以枚举每条要删的边,再在两个子树中求树的直径,相乘即为答案。 本题我采用两次\(bfs\)的方式求树的直径。 另外,记得打上删除标记。 时间复

  • CF741D Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths 树上启发式合并(DSU ON TREE)2020-10-08 17:01:40

    题目描述 一棵根为\(1\) 的树,每条边上有一个字符(\(a-v\)共\(22\)种)。 一条简单路径被称为\(Dokhtar-kosh\)当且仅当路径上的字符经过重新排序后可以变成一个回文串。 求每个子树中最长的\(Dokhtar-kosh\)路径的长度。 输入输出样例 输入 #1 4 1 s 2 a 3 s 输出 #1 3 1 1 0 输

  • 【leetcode】不邻接植花2020-09-28 08:32:22

      int cmp(const void* a, const void* b){ return (*(int**)a)[0] > (*(int**)b)[0]; } int* gardenNoAdj(int N, int** paths, int pathsSize, int* pathsColSize, int* returnSize){ int i,j,k,temp,pst,cnt=2; for (i = 0; i < pathsSize; i++) {

  • 1042. 不邻接植花2020-09-25 21:02:04

    1042. 不邻接植花 有 N 个花园,按从 1 到 N 标记。在每个花园中,你打算种下四种花之一。 paths[i] = [x, y] 描述了花园 x 到花园 y 的双向路径。 另外,没有花园有 3 条以上的路径可以进入或者离开。 你需要为每个花园选择一种花,使得通过路径相连的任何两个花园中的花的种

  • 30 Day Challenge Day 13 | Leetcode 62. Unique Paths2020-09-25 05:03:14

    题解 Easy. 动态规划。 class Solution { public: int uniquePaths(int m, int n) { vector<vector<int>> dp(m, vector<int>(n)); for(int i = 0; i < m; i++) dp[i][0] = 1; for(int j = 0; j < n; j++) dp[0][j] =

  • 30 Day Challenge Day 13 | Leetcode 63. Unique Paths II2020-09-25 05:02:57

    题解 Medium 动态规划 class Solution { public: int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) { if(obstacleGrid.empty()) return 0; int m = obstacleGrid.size(), n = obstacleGrid[0].size();

  • 980. Unique Paths III2020-09-24 04:33:05

    On a 2-dimensional grid, there are 4 types of squares: 1 represents the starting square.  There is exactly one starting square. 2 represents the ending square.  There is exactly one ending square. 0 represents empty squares we can walk over. -1 repres

  • 关于vue 项目中使用@符号替代src 目录 vscode 不能自动提示的解决办法2020-08-12 15:00:39

    在项目根目录中新建jsconfig.json 文件   写入一下代码   { "compilerOptions": { "baseUrl": ".", "paths": { "@/*": [ "src/*" ] }, }, "include": [ "src/**/*&qu

  • 0797. All Paths From Source to Target (M)2020-07-25 08:33:48

    All Paths From Source to Target (M) 题目 Given a directed, acyclic graph of N nodes. Find all possible paths from node 0 to node N-1, and return them in any order. The graph is given as follows: the nodes are 0, 1, ..., graph.length - 1. graph[i] is a list

  • [LeetCode] 1059. All Paths from Source Lead to Destination2020-07-25 04:31:13

    Given the edges of a directed graph, and two nodes source and destination of this graph, determine whether or not all paths starting from source eventually end at destination, that is: At least one path exists from the source node to the destinat

  • LeetCode刷题之——62. Unique Paths(单一路径)2020-07-09 15:37:25

    62. Unique Paths(机器人走网格的单一路径数量)   A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-ri

  • FileOutputStream write与原文件md5不一致,文件变大了 或者 ResponseEntity 下载的文件与原文件md5值不一样2020-07-02 13:35:15

    FileOutputStream write与原文件md5不一致,文件变大了 原因写入的时候字符问题代码如下:   public static void main(String[] args) throws IOException { String fileName = "aaa.jar"; System.out.println("start"); // Files.copy(Paths.get(path

  • Path、Paths、Files的使用2020-06-18 09:04:18

    1.NIO的使用说明: Java NIO (New IO,Non-Blocking IO)是从Java 1.4版本开始引入的一套新的IO API,可以替代标准的Java IO AP。 NIO与原来的IO同样的作用和目的,但是使用的方式完全不同,NIO支持面向缓冲区的(IO是面向流的)、基于 通道的IO操作。 NIO将以更加高效的方式进行文件的读写操

  • Java IO流篇文章阅读顺序2020-06-18 09:03:36

    File类的使用 IO流概述 节点流(或文件流) 缓冲流的使用 转换流的使用 其它的流的使用 对象流的使用 RandomAccessFile的使用 Path、Paths、Files的使用

  • Educational Codeforces Round 89 (Rated for Div. 2) C - Palindromic Paths(回文路径,思维)2020-06-13 19:04:52

    题目链接 题意 给你一个n*m的01矩阵,现在我们要从起点(1,1)到(n,m)并且每一步只能向下或者向右走,现在要求他能走到终点的路径必须全部是回文(比如01010),问最少改动多少个元素,使得满足条件 思路: 例:矩阵为 1.首先,要是路径为回文,那么我现在走的第一步,和最后走的一步肯定要相

  • [CF741D]Arpa's letter-marked tree and Mehrdad's Dokhtar-kosh paths2020-06-05 10:04:23

    题目 传送门 题解 由树启发算法发明者出的题。 涉及回文,那么我们来想一下回文的特性: 最多只有一种字符出现奇数次的一堆字符才会被重新排序成为一个回文串。 所以,这道题我们只需要知道,在某一条链上,有多少字符出现奇数次,而偶数次的字符我们可以忽略。 这有点想什么?是不是二进制中

  • 运用Filebeat module分析nginx日志2020-05-08 11:01:18

    在同一台主机上事先安装好filebeat,elasticsearch和kibana filebeat配置 安装完Filebeat后,可以看到在Filebeat的安装目录下有一个叫做filebeat.yml的配置文件,还有一个叫做modules.d的文件夹。在filebeat.yml中,我们做如下的修改: setup.kibana: host: "localhost:5601" output.e

  • leetcode-187周赛-5400-旅行终点站2020-05-03 20:57:51

      提交:O(N) class Solution: def destCity(self, paths: List[List[str]]) -> str: dic = {} for i,v in paths: dic[i] = v tmp = paths[0][1] while tmp in dic: tmp = dic[tmp] return tmp  

  • 1155 Heap Paths (30分)2020-05-02 14:07:59

    In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater than or equal to (in a max heap) or less than or equal to (in a min heap)

  • Codeforces 1144F Graph Without Long Directed Paths DFS染色2020-04-28 16:53:01

    题意: 输入一张有向图,无自回路和重边,判断能否将它变为有向图,使得图中任意一条路径长度都小于2。 如果可以,按照输入的边的顺序输出构造的每条边的方向,构造的边与输入的方向一致就输出1,否则输出0。   题解: 当我看到“图中任意一条路径长度都小于2”这句话的时候我都懵了,不知道这道题

  • 二叉树的所有路径与旋转数组2020-04-15 10:56:27

    解题思路:先判断当前节点是否为空,不为空则加入路径中,若不为空,判断该节点是否为叶子节点,为叶子节点则将路径加入答案,否则继续递归左右子树. 给定一个二叉树,返回所有从根节点到叶子节点的路径。 说明: 叶子节点是指没有子节点的节点。 示例: 输入: 1/ \2 3\5 输出: ["1->

  • leetcode 62. Unique Paths2020-04-09 18:02:09

    leetcode 62. Unique Paths A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of

  • 1155 Heap Paths2020-03-21 21:52:41

    题干前半略。 Sample Input 1: 8 98 72 86 60 65 12 23 50   Sample Output 1: 98 86 23 98 86 12 98 72 65 98 72 60 50 Max Heap   Sample Input 2: 8 8 38 25 58 52 82 70 60   Sample Output 2: 8 25 70 8 25 82 8 38 52 8 38 58 60 Min Heap   Sample Input 3: 8 10

  • LeetCode 1042. Flower Planting With No Adjacent2020-03-21 13:51:28

    原题链接在这里:https://leetcode.com/problems/flower-planting-with-no-adjacent/ 题目: You have N gardens, labelled 1 to N.  In each garden, you want to plant one of 4 types of flowers. paths[i] = [x, y] describes the existence of a bidirectional path from

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

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

ICode9版权所有