ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#170408 | #1260. 化简分数 | luojianwei2216 | 100 | 0ms | 1200kb | C++ | 277b | 2023-04-20 21:55:34 | 2023-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'