摘要: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>
阅读全文
摘要:孤独的照片-枚举+乘法原理 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
阅读全文
摘要: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
阅读全文
摘要:约数个数 有$n(n<=100)$个数x$(int范围内)$, 输出这些数的乘积的约数个数. #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0) # include <bits/stdc++.h> using namespace
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; unordered_map<char, int> pr = {{'*', 2}, {'/', 2}, {'+', 1}, {'-', 1}}; stack<int> num; stack<char> op;
阅读全文
摘要:数论 Description $$ 给定n, m \in [1, 1e9]\ 找到使得res=n \cdot x末尾零的个数最多, 结果最大的x, 其中,\ x \in [1, m] $$ Solution 容易联想到经典题目, 求阶乘末尾零的数量. 只需要找到$n$中$2$和$5$的因子个数, 再
阅读全文