摘要: Leetcode-Python3 [1.两数之和] 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: 给定 nums = [2, 7, 阅读全文
posted @ 2019-11-25 15:28 莜莫 阅读(453) 评论(0) 推荐(0) 编辑
摘要: 1 int Scan()///输入外挂 2 { 3 int res=0,ch,flag=0; 4 if((ch=getchar())=='-') 5 flag=1; 6 else if(ch>='0'&&ch='0'&&ch '9')) c++; 10 if(c >= sz) return false; 11 ... 阅读全文
posted @ 2019-05-03 11:14 莜莫 阅读(415) 评论(0) 推荐(0) 编辑
摘要: 题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6044 题意: 对于有n个元素的全排列的合法性定义为:有n个区间,对于第i个区间[li,ri]有li<=i<=ri,对于任意1<=L<=i<=R<=n,当前仅当li<=L<=i<=R<=ri时P[i]= 阅读全文
posted @ 2019-05-03 11:12 莜莫 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6035 题意: 给出一颗树, 树上路径权值等于路径上不同颜色的数量,求所有路径权值之和; 解题思路: 大佬讲的很清楚了:https://blog.csdn.net/qust1508060414/arti 阅读全文
posted @ 2019-05-03 11:05 莜莫 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6034 题意: 给出 N 个字符串,要求我们对每个字符映射成 0~25中的一个数字,要求最后所有字符串转换为26进制能得到的最大值。 解题思路: 统计每个字符在每一位上得贡献(用数组模拟26进制),然后按照 阅读全文
posted @ 2019-05-03 10:53 莜莫 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://poj.org/problem?id=3415 题意:给定两个串,求长度不小于 k 的公共子串的个数 解题思路: 常用技巧,通过在中间添加特殊标记符连接两个串,把两个串的问题转换为 一个串的问题按照 height 分组。这里有两种情况一、后缀排名中, B的后缀在后 A的后缀在前 阅读全文
posted @ 2019-04-29 21:11 莜莫 阅读(261) 评论(0) 推荐(0) 编辑
摘要: Football Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 451 Accepted: 178 Description Alice and Bob both love football very much, and 阅读全文
posted @ 2019-04-19 19:29 莜莫 阅读(255) 评论(0) 推荐(0) 编辑
摘要: H. Split Game time limit per test 1.0 s memory limit per test 256 MB input standard input output standard output For a long time, rich clientele of Bi 阅读全文
posted @ 2019-04-18 19:57 莜莫 阅读(363) 评论(0) 推荐(0) 编辑
摘要: HDU 2174 kiki's game 题意:有一个N*M的棋盘,起点在右上角,两个人每轮可把棋子向左、向下或者向左下移动一格,直到不能移动棋子者输。 NP图解决: 概念: 必败点(P点):前一个选手将取胜的位置称为必败点。 必胜点(N点):下一个选手将取胜的位置成为必胜点。 性质: 步骤: NP 阅读全文
posted @ 2019-04-18 19:14 莜莫 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 任意门:http://codeforces.com/gym/101954/problem/E E. Locker Room time limit per test 2.0 s memory limit per test 256 MB input standard input output stand 阅读全文
posted @ 2019-04-15 22:58 莜莫 阅读(525) 评论(0) 推荐(0) 编辑