摘要: link code #include<bits/stdc++.h> using namespace std; const int N = 100010; int a[N]; int tp[N]; long long ans; void merge(int l, int r){ if(l >= r) 阅读全文
posted @ 2023-04-07 21:33 天黑星更亮 阅读(15) 评论(0) 推荐(0)
摘要: link code #include<bits/stdc++.h> using namespace std; typedef long long ll; //注意先除以x后乘以b ll gcd(ll a, ll b){ return b ? gcd(b, a % b) : a; } int main 阅读全文
posted @ 2023-04-07 20:17 天黑星更亮 阅读(31) 评论(0) 推荐(0)
摘要: link code #include<bits/stdc++.h> using namespace std; const int N = 100010; int fa[N], a[N]; int cnt[N]; int find(int x){ if(x != fa[x]) fa[x] = find 阅读全文
posted @ 2023-04-07 19:55 天黑星更亮 阅读(39) 评论(0) 推荐(0)
摘要: link code #include<bits/stdc++.h> using namespace std; const int N = 100010; int a[N],b[N]; int main(){ int n, m; cin >> n >> m; for(int i = 1; i <= n 阅读全文
posted @ 2023-04-07 19:29 天黑星更亮 阅读(14) 评论(0) 推荐(0)
摘要: link code #include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int n; int ans = 1, tpr = 0; vector<pair<int,int>>v; int l, r 阅读全文
posted @ 2023-04-07 19:21 天黑星更亮 阅读(17) 评论(0) 推荐(0)
摘要: link code #include<iostream> #include<unordered_map> using namespace std; int main(){ unordered_map<char, int >mp; string s; cin>> s; for(int i = 0; i 阅读全文
posted @ 2023-04-07 17:31 天黑星更亮 阅读(19) 评论(0) 推荐(0)
摘要: link 代码 #include<iostream> using namespace std; const int N = 100010; int cnt[N]; int main(){ int n, k; cin >> n >> k; long long ans = 0; long long su 阅读全文
posted @ 2023-04-07 17:22 天黑星更亮 阅读(28) 评论(0) 推荐(0)
摘要: link 代码 #include<bits/stdc++.h> using namespace std; const int N = 1010; //如果坏人可以到达终点,并且距离终点的距离小于等于 起点到终点的距离,那么必然会相遇 //所以我们从终点出发找起点,在找到起点之前如果到达坏人所在地方, 阅读全文
posted @ 2023-04-07 16:52 天黑星更亮 阅读(21) 评论(0) 推荐(0)
摘要: 原题链接 思路 本题目数据量较弱,所以可以考虑直接用dfs 代码 #include<iostream> using namespace std; int ans; void dfs(int n, int d, int k){ if(k == 0){ if(n == 0) ans++; return; 阅读全文
posted @ 2023-04-07 15:59 天黑星更亮 阅读(22) 评论(0) 推荐(0)