当前位置:网站首页>E. Add Modulo 10(规律)
E. Add Modulo 10(规律)
2022-08-02 18:41:00 【Harris-H】
E. Add Modulo 10(规律)
可以看出末位为1、3、6、7、9 最终会进入到2、4、8、6的循环。
2 + 4 + 8 + 6 = 20 2+4+8+6=20 2+4+8+6=20,这个周期的长度为20。
对于末位 5 , 0 5,0 5,0 最终会变成末位为0。
因此分两种情况: 0 、 2 0、2 0、2。
先把第一种情况末位变成为2,然后模20,第二种情况就变成末位为0,不取模。
然后比较 n n n个数是否相同。
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t; cin >> t;
while(t--)
{
int n; cin >> n;
vector<int> a(n);
// 2 0
for (int i = 0; i < n; i++) {
cin >> a[i];
while(a[i]%10 != 2 && a[i]%10 != 0) {
a[i] += a[i]%10;
}
if(a[i]%10 == 2) {
a[i] %= 20;
}
}
cout << (a == vector(n, a[0]) ? "Yes\n":"No\n");
}
return 0;
}
边栏推荐
- Mysql基础篇(视图)
- [论文分享] VideoFlow: A Flow-Based Generative Model for Video
- pydev debugger: warning: trying to add breakpoint to file that does not exist: /tmp/xxx
- Functional test points for time, here is a comprehensive summary for you
- 喜迎八一 《社会企业开展应聘文职人员培训规范》团体标准出版发行会暨橄榄枝大课堂上线发布会在北京举行
- 【C语言刷题】Leetcode238——除自身以外数组的乘积
- 连续三次 | 灵雀云入选Gartner中国ICT技术成熟度曲线报告
- 【软考软件评测师】基于经验的测试技术
- 从技术全景到场景实战,透析「窄带高清」的演进突破
- T5: Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
猜你喜欢
随机推荐
回收站删除的文件怎么恢复,2个方法汇总助您快速解决
什么是会话劫持以及如何阻止它
【C语言刷题】双指针原地修改数组(力扣原题分析)
项目分析(复杂嵌入式系统设计)
知识点滴 - 什么是iAP2 (上)
通信大学生走向岗位,哪些技能最实用?
安装Mac版Mysql卡在Installation阶段,彻底清理mysql并重装mysql
[论文分享] VideoFlow: A Flow-Based Generative Model for Video
深入理解IO流(第一篇)
读书笔记之《你想过怎样的一生?》
如何获取EasyCVR平台设备通道的RTMP视频流地址?
说一件事
I have 8 years of experience in the Ali test, and I was able to survive by relying on this understanding.
VSTO踩坑记录(1)- 从零开始开发outlook插件
麦聪DaaS平台 3.7.0 Release 正式发布:全面支持国际化
C#里如何简单的校验时间格式
共享平台如何提高财务的分账记账效率?
被审稿人吐槽没有novelty!深度学习方向怎么找创新点?
Mysql基础篇(视图)
7.23 - 每日一题 - 408









