用户输出
1 35
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#64124 | #106. zxh的同值猜想 | Accepted | 100 | 49 ms | 428 K | C++ 17 / 2.7 K | feicheng | 2022-01-27 0:00:36 |
// Author:Feicheng
#ifndef fast_io
#define fast_io
#endif
#include <cstdio>
#include <cstring>
namespace fast_io {
constexpr int WTZ = 1 << 21;
char buf[WTZ], buff[WTZ], *t1 = buf, *t2 = buf, *HL = buff;
#define getc() (t1 == t2 && (t2 = (t1 = buf) + fread(buf, 1, WTZ, stdin), t1 == t2) ? EOF : *t1++)
inline void flush() { fwrite(buff, 1, HL - buff, stdout); }
inline void putc(const char& ch) {
if (HL == buff + WTZ) {
flush();
HL = buff;
}
*HL++ = ch;
}
class Istream {
public:
template <typename _Tp>
inline Istream& operator>>(_Tp& value) {
char ch = getc();
int flag = 0;
value = 0;
while (ch > '9' || ch < '0') {
if (ch == '-') {
flag = 1;
}
ch = getc();
}
while (ch <= '9' && ch >= '0') {
value = value * 10 + (ch - '0');
ch = getc();
}
value = flag ? -value : value;
return *this;
}
inline Istream& operator>>(char& ch) {
ch = getc();
while (ch == ' ' || ch == '\n' || ch == '\r' || ch == EOF) {
ch = getc();
}
return *this;
}
inline Istream& operator>>(char str[]) {
char ch = getc();
int len = 0;
while (ch == ' ' || ch == '\r' || ch == '\n' || ch == EOF) {
ch = getc();
}
while (ch != ' ' && ch != '\r' && ch != '\n' && ch != EOF) {
str[len++] = ch;
ch = getc();
}
str[len] = '\0';
return *this;
}
} in;
class Ostream {
public:
~Ostream() { flush(); }
template <typename _Tp>
inline Ostream& operator<<(_Tp value) {
static char stk[20];
unsigned int tp = 0;
if (!value) {
putc('0');
return *this;
}
if (value < 0) {
putc('-');
value = -value;
}
while (value) {
stk[++tp] = value % 10 + 48;
value /= 10;
}
while (tp) {
putc(stk[tp--]);
}
return *this;
}
inline Ostream& operator<<(const char& ch) {
putc(ch);
return *this;
}
inline Ostream& operator<<(char str[]) {
char* ch = str;
while (*ch != '\0') {
putc(*ch++);
}
return *this;
}
inline Ostream& operator<<(const char str[]) {
const char* ch = str;
while (*ch != '\0') {
putc(*ch++);
}
return *this;
}
} out;
#undef getc
} // namespace fast_io
using fast_io::in;
using fast_io::out;
/* -------- Main part of the Program--------*/
#include "bits/stdc++.h"
using std::cin;
using std::cout;
__uint128_t gcd(const __uint128_t& a, const __uint128_t& b) { return b ? gcd(b, a % b) : a; }
int main(int argc, const char** argv) {
#ifdef Feicheng
freopen("input.in", "r", stdin);
freopen("output.ans", "w", stdout);
#endif
std::basic_ios<char>::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
__uint128_t a, b;
in >> a >> b;
auto v = gcd(a, b);
out << v << ' ' << a / v * b;
return 0;
}
用户输出
7 14057750781710727
系统信息
Exited with return code 0
用户输出
2 28974979732195296
系统信息
Exited with return code 0
用户输出
3 19260972967518327
系统信息
Exited with return code 0