当前位置:网站首页>Codeforce:a. difference operations [mathematical thinking]
Codeforce:a. difference operations [mathematical thinking]
2022-07-19 13:26:00 【White speed Dragon King's review】

analysis
In order to make a[1:] All change 0
First a[1] Must be a[0] Multiple , And then in a[1] become 0 In the process of
Its number is a[0] Multiple
Then in order to make a[2] Also become 0, a[2] You must subtract several a[1] The median value is 0
therefore a[2] It's also a[0] Multiple
So let's see if the back ones are all a[0] Multiple of
Ac code
import sys
input = sys.stdin.readline
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
flag = True
for i in range(1, n):
if a[i] % a[0] != 0:
flag = False
break
if flag:
print('YES')
else:
print('NO')
summary
The first question is thinking
The code must be short
That is to summarize the operation and get a rule
边栏推荐
- torch.utils.data.DataLoader说明
- 最懂你的服装设计师是AI?让用户 “凭心意” 生成数字服装#Adidas OZWORLD
- Flask source code analysis (III): Context
- 关于TCP/IP协议漏洞的安全措施
- Realize automatic logging
- MOF customized material | NH (2) -uio66/rgo Graphene Oxide Nanocomposite | methylene blue loaded zif-90 nanoparticles
- Label ball problem
- XML建模(简单易学)
- Equivalent domain name
- STL string输出与修改
猜你喜欢

codeforce:A. Difference Operations【数学思维】

Qiyue supplies cumof nanocrystals loaded with methylene blue | femof nanosheets grown in situ on foam nickel | oxide nanowires /zif MOFs sugar gourd like Composites

Wrong again, byte alignment and the use of pragma pack

每周小结(*65):有计划的输出

Array simulation queue

sqli-labs(less-11)

Reg of sequential logic and combinatorial logic

Azkaban installation documentation

Stable super odds, 9 years old mixin | 2022 Jincang innovative product launch was successfully held

音频常见端子剖析图---再也不会搞错了
随机推荐
codeforce:G. Good Key, Bad Key【贪心】
MySQL sort index failure?
MatrixCube揭秘 101——MatrixCube的功能与架构
Azkaban installation documentation
LeetCode 0118. 杨辉三角
MOF customized material | NH (2) -uio66/rgo Graphene Oxide Nanocomposite | methylene blue loaded zif-90 nanoparticles
Module 7 (Architecture Design of King glory mall)
Atmospheric non isohalo effect
Equivalent domain name
Array simulation queue
【南瓜书ML】(task2)线性模型的数学推导(最小二乘估计、广义瑞利商、极大似然估计等)
Attachment handling of SAP Fiori
2022年最新吉林建筑安全员模拟题库及答案
The latest Jilin construction safety officer simulation question bank and answers in 2022
codeforce:A. Difference Operations【数学思维】
LeetCode 0117. Populate the next right node pointer II of each node
模块7(王者荣耀商城异地多活架构设计)
每周小结(*65):有计划的输出
MOF customized materials | ultra thin MOF nanobelts | magnetic Fe3O4 @cd-mof nanocomposites | zif-8/ graphene composite nanoparticles
(PC+WAP)织梦模板服装礼服类网站