摘要: 水题,贪心,一个灯亮两个格子就行,所以就是 (m*n+1)>>1 #include<bits/stdc++.h> using namespace std; #define rep(i,j,k) for(LL i=(j); i<(k); ++i) #define pb push_back #defin 阅读全文
posted @ 2020-05-27 08:46 CrosseaLL 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 首先要下载MinGW,直接去官网下载就行 如果官网下载失败,可以直接找压缩包 然后直接new一个build system输入以下内容即可 { "encoding": "utf-8", "working_dir": "$file_path", "shell_cmd": "g++ -Wall -std= 阅读全文
posted @ 2020-05-26 15:19 CrosseaLL 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 暴力完事 python class Solution: def maxVowels(self, s: str, k: int) int: a = [0] (len(s)+3) word = ['a', 'e','i','o','u'] for i,w in enumerate(s): if w in 阅读全文
posted @ 2020-05-24 19:16 CrosseaLL 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 求每一种字符出现次数的前缀和,然后二分答案的长度就可 阅读全文
posted @ 2020-05-17 22:20 CrosseaLL 阅读(256) 评论(0) 推荐(0) 编辑
摘要: Sample Input 5 4 1 2 3 4 5 5 1 3 1 Sample Output 3 思路,首先发现a[i]的值的范围是在1~n之间,每次插入我们可以直接把cnt[a[i]]++ 删除的时候,要把所有在后面的数往前挪一位,那么其实也相当于所有在后面的数的前面 的cnt的前缀和减去1, 阅读全文
posted @ 2020-05-17 21:44 CrosseaLL 阅读(310) 评论(0) 推荐(1) 编辑
摘要: 暴力完事 直接拆分排序组合 c++ class Solution { public: bool in(bool cnt[100][1001], int i, int j, int len){ for(int k=0; k peopleIndexes(vector & a) { bool cnt[10 阅读全文
posted @ 2020-05-17 14:46 CrosseaLL 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 思维,一个数0,两个数m,三个数以上,先放0 m 0,结果是2 m include using namespace std; define rep(i,j,k) for(int i=(j); i define PLL pair define ini(a,j) memset(a,j,sizeof a) 阅读全文
posted @ 2020-05-15 15:22 CrosseaLL 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 反手就是一波欧拉筛,~~忘记给0和1赋值为1~~坑死我了 阅读全文
posted @ 2020-05-11 22:08 CrosseaLL 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 先求出第一个值,然后二分第二个数的基数就可以 阅读全文
posted @ 2020-05-11 17:18 CrosseaLL 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 直接线性扫描就好 c++ class Solution { public: int countTriplets(vector& a){ int presum[301]; int ans=0; for(int i=0; i仔细观察,会发现要走过的点刚好是一棵树 直接一遍dfs将所有子节点有苹果的点标记 阅读全文
posted @ 2020-05-10 14:58 CrosseaLL 阅读(126) 评论(0) 推荐(0) 编辑