用户工具

站点工具


2020-2021:teams:too_low:cfedu92hj

这是本文档旧的修订版!


A.LCM Problem

https://codeforces.com/contest/1389/problem/A

题意: 找到[l, r]范围内的两个数x < y使得其最小公倍数也在[l, r]范围内。

设x = p * gcd(x, y) ,y = q * gcd(x, y) ,pq互质。lcm(x, y) = pq*gcd(x, y)。 x确定时y = 2x 时lcm(x, y) = y取到最小值

x = l时存在解有= 2*l。判断r是否小于2*l即可。

点击以显示 ⇲

点击以隐藏 ⇱

#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;
 
 
 
int main() {
    int t = 0;
    cin >> t;
    while (t--) {
        LL l, r;
        cin>>l>>r;
        if(r < 2 * l)cout<<-1<<' '<<-1<<endl;
        else cout<<l<<' '<<2*l<<endl;
    }
 

B.Array Walk

题意:找到[l, r]范围内的两个数x, y使得其最小公倍数也在[l, r]范围内。

点击以显示 ⇲

点击以隐藏 ⇱

 

C.Good String

https://codeforces.com/contest/1389/problem/A 题意:找到[l, r]范围内的两个数x, y使得其最小公倍数也在[l, r]范围内。

点击以显示 ⇲

点击以隐藏 ⇱

 

D.Segment Intersections

https://codeforces.com/contest/1389/problem/A 题意:找到[l, r]范围内的两个数x, y使得其最小公倍数也在[l, r]范围内。

点击以显示 ⇲

点击以隐藏 ⇱

 

E.Segment Intersections

2020-2021/teams/too_low/cfedu92hj.1596186713.txt.gz · 最后更改: 2020/07/31 17:11 由 jim