2022年12月25日

每日一题-思维

摘要: CF Round #840-C.Another Array Problem 描述 给定一个包含$n$个元素的序列$a$, 可以进行以下操作任意次: 选择下标$i, j(1<=i<j<=n)$, 将所有$a_k$替换为$|a_i-a_j|(i<=k<=j)$. 问序列能操作出的最大元素和. 思路 n> 阅读全文

posted @ 2022-12-25 21:55 Whosedream-0019 阅读(29) 评论(0) 推荐(0)

2022年12月21日

每日一题-枚举+乘法原理

摘要: 孤独的照片-枚举+乘法原理 void solve() { int n; string s; cin >> n >> s; int ans = 0; for (int i = 0; i < n; ++i) { int l = i - 1, cnt1 = 0; while (l >= 0 and s[l 阅读全文

posted @ 2022-12-21 13:19 Whosedream-0019 阅读(137) 评论(0) 推荐(0)

2022年12月13日

每日一题-数论

摘要: Codeforces edu round 139 D - Lucky Chains 问题描述 给正整数$x, y(x<y)$, 如果$gcd(x, y), gcd(x+1, y+1) \dots gcd(x+k, y+k)都为1$, 则称这些数为Lucky Chain, 求$x, y$最长的Luck 阅读全文

posted @ 2022-12-13 17:06 Whosedream-0019 阅读(50) 评论(0) 推荐(0)

2022年12月8日

每日一题-约数个数

摘要: 约数个数 有$n(n<=100)$个数x$(int范围内)$, 输出这些数的乘积的约数个数. #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0) # include <bits/stdc++.h> using namespace 阅读全文

posted @ 2022-12-08 00:42 Whosedream-0019 阅读(28) 评论(0) 推荐(0)

2022年12月6日

每日一题-数据结构

摘要: #include <bits/stdc++.h> using namespace std; unordered_map<char, int> pr = {{'*', 2}, {'/', 2}, {'+', 1}, {'-', 1}}; stack<int> num; stack<char> op; 阅读全文

posted @ 2022-12-06 11:42 Whosedream-0019 阅读(28) 评论(0) 推荐(0)

每日一题-数论

摘要: 数论 Description $$ 给定n, m \in [1, 1e9]\ 找到使得res=n \cdot x末尾零的个数最多, 结果最大的x, 其中,\ x \in [1, m] $$ Solution 容易联想到经典题目, 求阶乘末尾零的数量. 只需要找到$n$中$2$和$5$的因子个数, 再 阅读全文

posted @ 2022-12-06 10:33 Whosedream-0019 阅读(29) 评论(0) 推荐(0)

2022年11月12日

每日一题-离散化

摘要: Interval Sum vector<int> all; vector<pair<int, int> > add, query; const int N = 3e5 + 5; // Attention! When worst case that l, r, x all different, we 阅读全文

posted @ 2022-11-12 00:10 Whosedream-0019 阅读(25) 评论(0) 推荐(0)

2022年11月10日

每日一题-区间合并

摘要: Merging Intervals sort(a.begin(), a.end()); vector<pair<int, int> > res; for (int i = 0; i < n; ++i) { int l = 0, r = res.size() - 1; while (l < r) { 阅读全文

posted @ 2022-11-10 23:32 Whosedream-0019 阅读(28) 评论(0) 推荐(0)

每日一题-判断子序列

摘要: 判断子序列 int j = 0, i = 0; while (i < m and j < n) { if (b[i] == a[j]) { j ++; } i ++; } cout << (j == n? "Yes" : "No"); description for given sequence $ 阅读全文

posted @ 2022-11-10 08:56 Whosedream-0019 阅读(29) 评论(0) 推荐(0)

2022年11月9日

每日一题-区间覆盖

摘要: 区间覆盖 sort(a.begin(), a.end()); int ans = 0, las = s; for (int i = 0; i < n; ++i) { int j = i; int r = -2e9; while (j < n and a[j].first <= las) { r = 阅读全文

posted @ 2022-11-09 21:53 Whosedream-0019 阅读(30) 评论(0) 推荐(0)

导航