QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#187845 | #7505. Billiard | bulijiojiodibuliduo# | AC ✓ | 32ms | 4068kb | C++17 | 885b | 2023-09-25 02:24:43 | 2023-09-25 02:24:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
int x,y;
void solve() {
int x,y;
scanf("%d%d",&x,&y);
printf("%lld\n",(ll)x*2/gcd(x,y)*y);
}
int _;
int main() {
for (scanf("%d",&_);_;_--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4068kb
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: 32ms
memory: 4040kb
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