UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#170408#1260. 化简分数luojianwei22161000ms1200kbC++277b2023-04-20 21:55:342023-04-20 21:55:37

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, m, maxc = 1;
	cin >> n >> m;
	for(int i = 2; i <= n; i++) {
		if(n % i == 0 && m % i == 0) maxc = i;
	}
	if(maxc == 1) cout << n << '/' << m;
	else cout << n / maxc << '/' << m / maxc;
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 33
Accepted
time: 0ms
memory: 1200kb

input:

24 64

output:

3/8

result:

ok single line: '3/8'

Test #2:

score: 33
Accepted
time: 0ms
memory: 1196kb

input:

5 9

output:

5/9

result:

ok single line: '5/9'

Test #3:

score: 33
Accepted
time: 0ms
memory: 1196kb

input:

156 568

output:

39/142

result:

ok single line: '39/142'