摘要: 要学习的code class Solution { static constexpr string VOWELS = "aeiou"; //这个constexpr就是强调,这个绝对不可以变 template<ranges::input_range R> /*这个写法,我定义了一个模板,但为了防止你传 阅读全文
posted @ 2026-03-14 10:34 Time_q 阅读(14) 评论(0) 推荐(0)
摘要: auto&&f leetcode3823, 我的低级写法 class Solution { public: string reverseByType(string s) { string ans; vector<char>alpha,spec; for(char c:s){ if(islower(c 阅读全文
posted @ 2026-03-13 22:05 Time_q 阅读(13) 评论(0) 推荐(0)
摘要: 题目大意,就是给你一个图,要求这个图的联通块要等于两个,你可以做的操作是把其中的某几条线给删除掉 *输入 5 7 2 3 1 2 1 5 4 5 2 4 3 5 1 3 输出 22 解题思路 每条边的边权时2^i次方(1<=i<=m) 策略是要尽可能的保住边权大的那条边,之所以从开始就是为了保住i更 阅读全文
posted @ 2026-03-13 13:00 Time_q 阅读(18) 评论(0) 推荐(0)
摘要: 被自己蠢哭了 本人蒟蒻,也许是因为是D题所以想的有点多了,如果放在B题的话说不定就。。。。。 code(没事找事版本,就是我自己调了半天的版本) void solve() { string s;cin>>s; s=" "+s; deque<int>back_char; deque<int>cnt_b 阅读全文
posted @ 2026-03-12 23:18 Time_q 阅读(14) 评论(0) 推荐(0)
摘要: 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 阅读(11) 评论(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 阅读(14) 评论(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 阅读(16) 评论(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 阅读(19) 评论(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 阅读(19) 评论(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 阅读(12) 评论(0) 推荐(0)