#include <bits/stdc++.h>
#define TASK C
#define I int
#define ll long long
#define ld long double
#define ull unsigned ll
#define nl '\n'
#define debug(a,n) \
for (I i=1;i<=(n);i++) \
cout<<(a)[i]<<" "; \
cout<<nl;
#define idebug(a,n) \
for (I i=n;i>=1;i--) \
cout<<(a)[i]<<" "; \
cout<<nl;
#define debug2(a,n) \
for (I i=1;i<=(n);i++) \
cout<<(a)[i].first<<" <<(a)[i].second<<nl;
#define idebug2(a,n) \
for (I i=n;i>=1;i--) \
cout<<(a)[i].first<<" <<(a)[i].second<<nl;
using namespace std;
const I vpn=1e6;
I t;
ll a,b,g,h;
map<pair<ll,ll>,pair<ll,ll>> nho;
ll edicul(ll a,ll b)
{
if (a<b)
return edicul(b,a);
if (b>1)
return edicul(a/b,b);
return a;
}
void DeoACLamCho()
{
cin>>g>>h;
if (g==h)
{
cout<<g<<" "<<h<<nl;
return;
}
if (h==2)
{
cout<<g<<" "<<2*g<<nl;
return;
}
if (g==h*h)
{
cout<<g<<" "<<g*h<<nl;
return;
}
if (g>h)
{
cout<<g<<" "<<g*h<<nl;
return;
}
for (I i=2;i<5000;i++)
for(I j=i+1;j<=5000;j++)
{
if (__gcd(i,j)==g&&edicul(i,j)==h)
cout<<i<<" "<<j<<nl;
return;
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>t;
while(t--)
DeoACLamCho();
}
Compilation message
euklid.cpp:18:25: warning: missing terminating " character
18 | cout<<(a)[i].first<<" <<(a)[i].second<<nl;
| ^
euklid.cpp:21:25: warning: missing terminating " character
21 | cout<<(a)[i].first<<" <<(a)[i].second<<nl;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
276 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Unexpected end of file - int64 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Unexpected end of file - int64 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
276 KB |
Output is correct |
21 |
Correct |
0 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
204 KB |
Output is correct |
23 |
Incorrect |
1 ms |
204 KB |
Unexpected end of file - int64 expected |
24 |
Halted |
0 ms |
0 KB |
- |