编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#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;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:5 ms
内存:428 KiB

输入文件(1.in

7 5

答案文件(1.out

1 35

用户输出

1 35

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(2.in

67 26

答案文件(2.out

1 1742

用户输出

1 1742

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(3.in

52 15

答案文件(3.out

1 780

用户输出

1 780

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:3 ms
内存:340 KiB

输入文件(4.in

96 77

答案文件(4.out

1 7392

用户输出

1 7392

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(5.in

8 12

答案文件(5.out

4 24

用户输出

4 24

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(6.in

87 33

答案文件(6.out

3 957

用户输出

3 957

系统信息

Exited with return code 0
测试点 #7
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(7.in

88 28

答案文件(7.out

4 616

用户输出

4 616

系统信息

Exited with return code 0
测试点 #8
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(8.in

76 54

答案文件(8.out

2 2052

用户输出

2 2052

系统信息

Exited with return code 0
测试点 #9
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(9.in

6 75

答案文件(9.out

3 150

用户输出

3 150

系统信息

Exited with return code 0
测试点 #10
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(10.in

53 53

答案文件(10.out

53 53

用户输出

53 53

系统信息

Exited with return code 0
测试点 #11
Accepted
得分:100
用时:3 ms
内存:352 KiB

输入文件(11.in

15734 71136

答案文件(11.out

2 559626912

用户输出

2 559626912

系统信息

Exited with return code 0
测试点 #12
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(12.in

70872 21669

答案文件(12.out

3 511908456

用户输出

3 511908456

系统信息

Exited with return code 0
测试点 #13
Accepted
得分:100
用时:3 ms
内存:376 KiB

输入文件(13.in

99784 94882

答案文件(13.out

2 4733852744

用户输出

2 4733852744

系统信息

Exited with return code 0
测试点 #14
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(14.in

95038 97852

答案文件(14.out

2 4649829188

用户输出

2 4649829188

系统信息

Exited with return code 0
测试点 #15
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(15.in

94814 98836

答案文件(15.out

2 4685518252

用户输出

2 4685518252

系统信息

Exited with return code 0
测试点 #16
Accepted
得分:100
用时:3 ms
内存:376 KiB

输入文件(16.in

95890 93558

答案文件(16.out

2 4485638310

用户输出

2 4485638310

系统信息

Exited with return code 0
测试点 #17
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(17.in

528340267 186251667

答案文件(17.out

7 14057750781710727

用户输出

7 14057750781710727

系统信息

Exited with return code 0
测试点 #18
Accepted
得分:100
用时:2 ms
内存:376 KiB

输入文件(18.in

367608218 157640544

答案文件(18.out

2 28974979732195296

用户输出

2 28974979732195296

系统信息

Exited with return code 0
测试点 #19
Accepted
得分:100
用时:3 ms
内存:376 KiB

输入文件(19.in

324952863 177819387

答案文件(19.out

3 19260972967518327

用户输出

3 19260972967518327

系统信息

Exited with return code 0
测试点 #20
Accepted
得分:100
用时:3 ms
内存:412 KiB

输入文件(20.in

541339672 595238966

答案文件(20.out

2 161113233308029576

用户输出

2 161113233308029576

系统信息

Exited with return code 0