摘要: lc 3306. 元音辅音字符串计数 II aeiou没必要一个一个敲 一个班级有10个人至少20岁,有3个人至少21岁,那么恰好20岁得人是多少?就是10-7,这题可以用这个思路来写,(灵神nb) class Solution { const string VOWEL = "aeiou"; //后 阅读全文
posted @ 2026-03-11 23:06 Time_q 阅读(2) 评论(0) 推荐(0)
摘要: 和相同的二元子数组 题目大意,就是求这个数组中和为k的子数组的个数 解题思路1:哈希map法 class Solution { public: int numSubarraysWithSum(vector<int>& nums, int goal) { int n=nums.size(); unor 阅读全文
posted @ 2026-03-11 22:03 Time_q 阅读(4) 评论(0) 推荐(0)
摘要: lc 2537. 统计好子数组的数目 code class Solution { public: long long countGood(vector<int>& nums, int k) { long long ans = 0; unordered_map<int, int> cnt; int p 阅读全文
posted @ 2026-03-11 17:04 Time_q 阅读(4) 评论(0) 推荐(0)
摘要: [原题链接(https://atcoder.jp/contests/dp/tasks/dp_j)] code #include<bits/stdc++.h> using namespace std; //"O campeão tem nome, e se chama Charles Oliveira 阅读全文
posted @ 2026-03-11 15:06 Time_q 阅读(5) 评论(0) 推荐(0)
摘要: 题目大意 这个是一个有向无环图, 然后求最长的那个路径, 错误解法 void solve() { int n,m,rec=INT_MIN;cin>>n>>m; vector<int>dp(n+1); while(m--){ int x,y;cin>>x>>y; dp[y]=max(dp[y],dp[ 阅读全文
posted @ 2026-03-10 21:48 Time_q 阅读(5) 评论(0) 推荐(0)
摘要: atcoder dp 题单 中的LCS (https://atcoder.jp/contests/dp/tasks) code #include<bits/stdc++.h> using namespace std; //"O campeão tem nome, e se chama Charles 阅读全文
posted @ 2026-03-10 13:28 Time_q 阅读(3) 评论(0) 推荐(0)
摘要: 牛客134 F 题目大意: 给一个字符串,求的是这个字符串的的总价值,这个总价值的求法是,这个字符串中所有回文连续子字符串的价值总和,这个回文子字符串的价值总和就是这个子字符串的长度的平方 (这位更是重量级:(https://anoth3r.top/nkwk134/)) code #include< 阅读全文
posted @ 2026-03-09 21:22 Time_q 阅读(5) 评论(0) 推荐(0)
摘要: 解法1 class Solution{ bool is_covered(unordered_map<int,int>&cnt_s,unordered_map<int,int>&cnt_t){ for(int i='A';i<='Z';i++){ if(cnt_s[i]<cnt_t[i])return 阅读全文
posted @ 2026-03-05 19:20 Time_q 阅读(3) 评论(0) 推荐(0)
摘要: 原题 (https://leetcode.cn/problems/minimum-size-subarray-in-infinite-array/) 原题代码 class Solution { public: int minSizeSubarray(vector<int>& nums, int ta 阅读全文
posted @ 2026-03-05 17:25 Time_q 阅读(4) 评论(0) 推荐(0)
摘要: 原题在此处 解题思路 这道题的原题大致意思可以看上面链接,有一种做法是逆向思维,也就是,只能从首部或者尾部取一个数字,那么剩下的部分肯定是连续的,假设数组长度为n,要取的数字的个数为k,也就是求数组中 n-k个连续子数组的最小值,用总和减去最小值就可以得到最终的答案 原题逆向思维解法代码 class 阅读全文
posted @ 2026-03-04 23:58 Time_q 阅读(5) 评论(0) 推荐(0)