1 solutions
Information
- ID
- 1609
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 4
- Tags
- (None)
- # Submissions
- 99
- Accepted
- 45
- Uploaded By
直接暴力枚举计算 gcd 即可。
想要使得 gcd(x,y) 最大,一个简单的想法是让 x=k,y=2k,因为数的范围要不大于 n,那么 k≤⌊2n⌋。
那么答案就是 ⌊2n⌋,因为如果要让答案 ans 再大的话 ⌊ansn⌋≤1,无法找出两个不同的数。
By signing up a Hydro universal account, you can submit code and join discussions in all online judging services provided by us.