D 绝地求生(pubg)
题目地址:
基本思路:
就是一个裸的,数据比较大用或者开都行
参考代码:
#pragma GCC optimize(2) #pragma GCC optimize(3) #include <bits/stdc++.h> using namespace std; #define IO std::ios::sync_with_stdio(false) #define int128 __int128 #define rep(i, l, r) for (int i = l; i <= r; i++) #define per(i, l, r) for (int i = l; i >= r; i--) #define mset(s, _) memset(s, _, sizeof(s)) #define pb push_back #define pii pair <int, int> #define mp(a, b) make_pair(a, b) #define INF (int)1e18 inline int128 read() { int128 x = 0, neg = 1; char op = getchar(); while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); } while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); } return neg * x; } inline void print(int128 x) { if (x < 0) { putchar('-'); x = -x; } if (x >= 10) print(x / 10); putchar(x % 10 + '0'); } signed main() { int t = read(); for(int cas = 1 ; cas <= t ; cas++) { int128 x = read(), y = read(); int128 ans = x / __gcd(x, y) * y; printf("Case %d: ",cas); print(ans); puts(""); } return 0; }