UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#167261#1260. 化简分数struct1000ms1184kbC++256b2023-01-01 22:24:092023-01-01 22:24:09

answer

//There's the KPEN code.
#include<bits/stdc++.h>
using namespace std;
//开始进入C++的世界
int x,y;
int r;
int main() {
	cin>>x>>y;
	int a=x,b=y;
		while(x%y!=0) {
			r=x%y;
			x=y;
			y=r;
		}
	printf("%d/%d",a/y,b/y);
	return 0;
}

Details

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

Test #1:

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

input:

24 64

output:

3/8

result:

ok single line: '3/8'

Test #2:

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

input:

5 9

output:

5/9

result:

ok single line: '5/9'

Test #3:

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

input:

156 568

output:

39/142

result:

ok single line: '39/142'