比赛 202110省实验桐柏一中普及组联赛 评测结果 AAAAAAAAWW
题目名称 分数约分 最终得分 80
用户昵称 lolo 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2021-10-18 20:12:42
显示代码纯文本
#include <fstream>

using namespace std;

unsigned long long _number1;
unsigned long long _number2;
unsigned long long _cc;

int Gdc (unsigned long long num1,unsigned long long num2) {
	
	unsigned long long temp;
	
	while (num2 > 0) {
		temp = num1 % num2;
		num1 = num2;
		num2 = temp; 
	}
	
	return num1;
}

int main () {
	
	ifstream in ("yuefen.in");
	ofstream out ("yuefen.out");
	
	in >> _number1;
	in >> _number2;
	
	if (_number1 == 0) {
		out << _number1;
		return 0;
	}
	
	_cc = Gdc(_number1,_number2); 
	
	_number1 /= _cc;
	_number2 /= _cc;
	
	if (_number2 == 1) {
		out << _number1;
		return 0;
	}
	
	out << _number1 << ' ' << _number2;
	
	in.close();
	out.close();
	return 0;
}