https://codeforces.com/problemset/problem/1714/E 题意简述 给你一个数组a,你可以对数组a中的任意一个元素进行任意次如下操作 a[i]=a[i]+a[i]%10 你需要判断这个数组是否能经过任意次操作后所有元素都相同,能则输出"YES",否则输出"NO" 题外话:这大概是写的目前为止最长的一篇题解了..(虽然题目不是很难) 样例 点击查
//Add Modulo 10:https://www.luogu.com.cn/problem/CF1714E #include<bits/stdc++.h> using namespace std; const int N=2e5+10; int res,n,m,k,t; set<int>s; int main() { cin>>t; while(t--){ cin>>n; s.clear(); for(int i=0;i<n;i++){ cin>>k; if(k%2) k=k+k%...
int n; int next(int x) { return x + x % 10; } void solve() { cin >> n; vector<int>vc(n); bool flag = 0; for (int i = 0; i < n; i++) { cin >> vc[i]; if (vc[i] % 5 == 0) { flag = 1; vc[i] = next(vc[i]); } } if (flag) { if (*min_eleme...
Print a single integer — the number of ways to flip some set of the roads so that the resulting whole set of all roads is not confusing. Since this number may be too large, print the answer modulo 109 + 7. Examples Input 3 2 3 1 Output 6 Input 4 2 1 1 1 Output 8 Input...