02 2020 档案
摘要:题意 There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at an
阅读全文
摘要:思路 用一个数组记录乘积的结果,最后处理进位。 代码
阅读全文
摘要:题目 给定一个字符串,请你找出其中不含有重复字符的最长子串的长度 思路 unordered__set 具备set互异性的特点,同时对插入的数据保留原顺序,即unordered。 本题的思想为“滑动窗口”,用unordered_set记录已扫描的字符,在插入前判断当前字符是否存在在已扫描的序列中。若存
阅读全文
摘要:题目 给定两个单词 word1 和 word2,计算出将 word1 转换成 word2 所使用的最少操作数 。 你可以对一个单词进行如下三种操作: 插入一个字符 删除一个字符 替换一个字符 思路 定义一个数组 代表第一个字符串前i个字符转换为第二个字符串前j个字符串所需要的缩少操作数。 如果wor
阅读全文
摘要:题目 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的数字可以无限制重复被选取。 说明: 所有数字(包括 target)都是正整数。 解集不能包含重复的组合。 样例 示例
阅读全文
摘要:Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the c
阅读全文
摘要:Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules
阅读全文
摘要:A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a re
阅读全文
摘要:To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C Programming Language, Mathematics
阅读全文
摘要:It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that c
阅读全文
摘要:Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is , if 6 is a decimal number and 110 is a bi
阅读全文
摘要:Given a sequence of K integers { N 1, N 2, ..., N K }. A continuous subsequence is defined to be { N i , N i +1, ..., N j } where 1≤ i ≤ j ≤ K . The M
阅读全文
摘要:1004 Counting Leaves (30分) A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. In
阅读全文
摘要:As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some ro
阅读全文
摘要:简介 pytorch是非常流行的深度学习框架。下面是Windows平台配置pytorch的过程。 一共需要安装cuda、pycharm、anancoda、pytorch。 主要介绍cuda和pytorch的安装。 安装cuda 1. 根据自己的显卡,选择合适的cuda版本。 百度输入CUDA,进入官
阅读全文
摘要:题干 给一个序列,让你求[l, r]中不同数字的个数 输入 输入一个n,随后是含有n个数字的序列 输入一个q,随后是两个整数,代表查询区间 输出 q个查询的结果 样例 思路 用一个树状数组记录序列前i个数字中,不同数字的个数。 从一个查询区间的左侧开始扫描: 1. 数字首次出现时,当前位置加一,且用
阅读全文