2023年3月26日
摘要: 比赛链接 这场前面顺,中间卡,后面用线段树模板过了一道题,剩下两题,倒二题是个背包DP,思想转换很重要 A题. 特判一下i和i-1就可 #include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--) 阅读全文
posted @ 2023-03-26 18:29 IR101 阅读(13) 评论(0) 推荐(0)
  2023年3月15日
摘要: 一拓扑排序: #include<bits/stdc++.h> using namespace std; const int N=100005; int idx,ne[2*N],e[2*N],h[N]; int d[N]; int ans[N],cnt; void add(int a, int b){ 阅读全文
posted @ 2023-03-15 20:04 IR101 阅读(12) 评论(0) 推荐(0)
  2023年3月14日
摘要: #include<iostream> #include <cstring> #include <algorithm> //#define int long long using namespace std; const int N = 500010; int w[N]; int n,m; struc 阅读全文
posted @ 2023-03-14 14:16 IR101 阅读(15) 评论(0) 推荐(0)
  2023年3月5日
摘要: #include<bits/stdc++.h> using namespace std; int prime[1000006],cnt; bool st[1000006]; void get_prime(int n){ for(int i=2;i<=n;i++){ if(!st[i]){ prime 阅读全文
posted @ 2023-03-05 16:35 IR101 阅读(11) 评论(0) 推荐(0)
摘要: NEW GAME #include <bits/stdc++.h> using namespace std; const int N=1010; int n,m; int dp[N]; int d[N]; vector<int>g[N]; vector<int>ans; void topo() // 阅读全文
posted @ 2023-03-05 15:27 IR101 阅读(22) 评论(0) 推荐(0)
  2023年3月4日
摘要: #include<bits/stdc++.h> using namespace std; #define ll long long ll n; ll zi[10005],cnt[10005]; ///转换成质数的积 ll k=0; int main(){ cin>>n; ll p=n; for (l 阅读全文
posted @ 2023-03-04 13:45 IR101 阅读(67) 评论(0) 推荐(0)
  2023年2月19日
摘要: 回文 思路:求组合后的字符串大小即可,每一个字符都是一个回文串 代码: #include <bits/stdc++.h> using namespace std; string s; long long huiwen(string a){ long long n = a.size(), ans = 阅读全文
posted @ 2023-02-19 20:01 IR101 阅读(89) 评论(0) 推荐(0)
摘要: P8800 [蓝桥杯 2022 国 B] 卡牌 做法:使用优先队列,只能拿到40分,可以二分最多可以形成多少套牌,时间复杂度Onlogn 代码: #include <bits/stdc++.h> using namespace std; #define ll long long ll n,m; in 阅读全文
posted @ 2023-02-19 19:17 IR101 阅读(24) 评论(0) 推荐(0)
  2023年2月12日
摘要: E. Hostel Cleaning 题意:一个圆桌子,n个人,每个位置的打扫成本是a[i],一给清洁工可以打扫连续的k个位置,k一定是n的因子,问最少需要多少成本 思路:因为k一定是n的因子,所以有起始位置是1到k,k种情况,因为k小,那n/k,就大,如果k大,n/k就小,因此就时间复杂度位n 代 阅读全文
posted @ 2023-02-12 17:39 IR101 阅读(12) 评论(0) 推荐(0)
摘要: P8742 [蓝桥杯 2021 省 AB] 砝码称重 题意:n个砝码,砝码的大小是a[i],问可以称量多少个不同大小的物品; 思路:运用DP,dp[j]是j重量的能否被称量; 代码: #include<bits/stdc++.h> using namespace std; int dp[101][1 阅读全文
posted @ 2023-02-12 14:57 IR101 阅读(60) 评论(0) 推荐(0)