import java.math.*;
import java.util.Scanner;
public class Main13_c {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int t = 0; t < T; t++) {
Rational r1 = new Rational(new BigInteger(sc.next()), new BigInteger(sc.next()));
Rational r2 = new Rational(new BigInteger(sc.next()), new BigInteger(sc.next()));
//이 두 줄 에러 뜹니다
System.out.println(r1 + " + " + r2 + " = " + r1.add(r2));
System.out.println(r1 + " - " + r2 + " = " + r1.subtract(r2));
System.out.println(r1 + " * " + r2 + " = " + r1.multiply(r2));
System.out.println(r1 + " / " + r2 + " = " + r1.divide(r2));
//여기서는 함수들이 인식이 안됩니다
}
}
}
class Rational {
Rational(){
}
BigInteger Rational(BigInteger a, BigInteger b) {
return a.divide(b);
}
}
뭐가 문제일까요....
에러가 많이 떠서 아직 제출은 안했습니다.
아래 코드를 참조하세요. (그냥 참조입니다)
import java.util.Scanner;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int t = 0; t < T; t++) {
Rational r1 = new Rational(new BigInteger(sc.next()), new BigInteger(sc.next()));
Rational r2 = new Rational(new BigInteger(sc.next()), new BigInteger(sc.next()));
//이 두 줄 에러 뜹니다
System.out.println(r1 + " + " + r2 + " = " + r1.add(r2));
//여기서는 함수들이 인식이 안됩니다
}
}
}
class Rational {
BigInteger a;
BigInteger b;
public Rational(){
}
public Rational(BigInteger a, BigInteger b)
{
this.a = a;
this.a = a;
}
public Rational add(Rational a) {
return new Rational();
}
}