title: Biweekly-Contest-122
date: 2024-01-29
Contest: leetcode
tags: Contest
Rank: 1205
status: DONE
Total: 2547
Credits: 7
T1: Accepted
T2: Accepted
T3: New Complement
T4: Uncommitted
author:
- AllenYGY
created: 2024-01-29
updated: 2024-05-31T00:37
publish: True
Biweekly-contest-122
- 开始的时候总想暴力,取第一个数然后两个for循环就过了
- 后来看到HMZ,选第一个数然后直接sort取前两位
- 刚开始想找规律来着,什么二进制数一的个数相同两者有无规律
- 后来,直接模拟就好了把能排序的从小到大拍一遍,最后看整个数组能不能有序就完了
while i<n:
start=i
while i<n and [condition]:
i+=1
#还没开始 可能还没开始看题
看完题解
也就是说,拿到最小的数之后可以用这个数吧其他不是它的倍数的数消掉
- 假设最小的数只有一个,那么最后只剩它自己
- 如果最小的数不止一个