QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#212091 | #7505. Billiard | chenxinyang2006 | AC ✓ | 29ms | 3928kb | C++14 | 1.0kb | 2023-10-13 08:48:24 | 2023-10-13 08:48:25 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define eb emplace_back
#define SZ(S) (int)S.size()
//#define mod 998244353
//#define mod 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
using namespace std;
template <class T>
void chkmax(T &x,T y){
if(x < y) x = y;
}
template <class T>
void chkmin(T &x,T y){
if(x > y) x = y;
}
inline int popcnt(int x){
return __builtin_popcount(x);
}
inline int ctz(int x){
return __builtin_ctz(x);
}
/*ll power(ll p,int k = mod - 2){
ll ans = 1;
while(k){
if(k % 2 == 1) ans = ans * p % mod;
p = p * p % mod;
k /= 2;
}
return ans;
}*/
int T,n,m;
int main(){
scanf("%d",&T);
while(T--){
scanf("%d%d",&n,&m);
printf("%lld\n",2ll * n / __gcd(n,m) * m);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3928kb
input:
5 2 2 2 3 2 4 2 5 2 6
output:
4 12 8 20 12
result:
ok 5 number(s): "4 12 8 20 12"
Test #2:
score: 0
Accepted
time: 29ms
memory: 3792kb
input:
100000 669308197 625790677 309402658 883960814 154288189 163799396 169512282 927758946 37480140 679939211 638101705 830820808 849697397 511857001 128162256 837500527 418377194 190545353 124951845 974336011 255633368 725343901 307301176 504671996 849730549 744535846 306521588 89276096 39998531 431540...
output:
837693659444558738 273499825419443612 50544624336267688 52422178694124924 50968433639539080 1060296348268555280 869847122771852794 214671913883017824 159439660235758964 243490164448780590 370844208741777136 77543148932533648 1265309706343518908 13682525358180224 34521982853617308 309194370418458864 ...
result:
ok 100000 numbers