-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJ04003.java
42 lines (39 loc) · 1.01 KB
/
J04003.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package CodePTIT;
/**
*
* @author NguyenVanDuc
*/
import java.util.Scanner;
public class J04003 {
static long gcd (long a, long b) {
if (b == 0) return a;
else return gcd(b, a%b);
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
PhanSo a = new PhanSo();
a.setTu(input.nextLong());
a.setMau(input.nextLong());
long ucln = gcd (a.getTu(), a.getMau());
System.out.println((a.getTu() / ucln) + "/" + (a.getMau()/ucln));
}
}
class PhanSo {
private long tu, mau;
public void setTu (Long tu) {
this.tu = tu;
}
public void setMau (Long mau) {
this.mau = mau;
}
public long getTu () {
return this.tu;
}
public long getMau () {
return this.mau;
}
}