比赛 202110省实验桐柏一中普及组联赛 评测结果 AAAAAAAAAA
题目名称 分数约分 最终得分 100
用户昵称 HeSn 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2021-10-18 19:10:23
显示代码纯文本
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define LL __int128
LL a, b;
LL read() {
    LL x = 0;
    string c;
    cin >> c;
    for(int i = 0; i < c.length(); i ++) {
        x *= 10;
        x += c[i] - '0';
    }
    return x;
}
LL gcd(LL x, LL y) {
    while(x > 0 && y > 0)
    {
    	LL t = x % y;
    	x = y;
    	y = t;
    }
    return x;
}
int print(LL x) {
    if(x > 9) {
        print(x / 10);
        int y = x % 10;
        cout << y;
    }
    else {
        int y = x % 10;
        cout << y;
    }
}
int main() {
	freopen("yuefen.in", "r", stdin);
	freopen("yuefen.out", "w", stdout);
    a = read();
    b = read();
    LL t = gcd(a, b);
    a = a / t;
    b = b / t;
    print(a);
    cout << ' ';
    print(b);
}