QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#650869 | #7505. Billiard | ucup-team5071# | AC ✓ | 30ms | 3692kb | C++20 | 372b | 2024-10-18 16:54:34 | 2024-10-18 16:54:34 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll solve()
{
ll n,m;cin>>n>>m;
ll g=__gcd(n,m);
ll t=n*m/g;
ll ans=t;
if((t/n)%2||(t/m)%2)ans*=2;
return ans;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int T;cin>>T;while(T--)cout<<solve()<<"\n";
}
/*
5
2 2
2 3
2 4
2 5
2 6
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
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: 30ms
memory: 3692kb
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