# 2019牛客暑期多校训练营（第一场）

## J Fraction Comparision

package acscut;

import java.math.*;
import java.util.*;

public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNext()) {
BigInteger x=sc.nextBigInteger();
BigInteger a=sc.nextBigInteger();
BigInteger y=sc.nextBigInteger();
BigInteger b=sc.nextBigInteger();
BigInteger p1=x.multiply(b);
BigInteger p2=y.multiply(a);
if(p1.compareTo(p2)==0) {
System.out.println("=");
}
else if(p1.compareTo(p2)>0) {
System.out.println(">");
}
else {
System.out.println("<");
}
}
sc.close();
}
}


package acscut;

import java.math.*;
import java.util.*;

public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNext()) {
long tmp;
tmp=sc.nextLong();
BigInteger x=BigInteger.valueOf(tmp);
tmp=sc.nextLong();
BigInteger a=BigInteger.valueOf(tmp);
tmp=sc.nextLong();
BigInteger y=BigInteger.valueOf(tmp);
tmp=sc.nextLong();
BigInteger b=BigInteger.valueOf(tmp);
x=x.multiply(b);
y=y.multiply(a);
int res=x.compareTo(y);
if(res==0)
System.out.println("=");
else if(res>0)
System.out.println(">");
else
System.out.println("<");
}
sc.close();
}
}


import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNext()) {
long tmp;
tmp=sc.nextLong();
BigInteger x=BigInteger.valueOf(tmp);
tmp=sc.nextLong();
BigInteger a=BigInteger.valueOf(tmp);
tmp=sc.nextLong();
BigInteger y=BigInteger.valueOf(tmp);
tmp=sc.nextLong();
BigInteger b=BigInteger.valueOf(tmp);
x=x.multiply(b);
y=y.multiply(a);
int res=x.compareTo(y);
if(res==0)
System.out.println("=");
else if(res>0)
System.out.println(">");
else
System.out.println("<");
}
}
}

class Scanner {
private StringTokenizer st;

Scanner(InputStream in) {
st = new StringTokenizer("");
}

String nextLine() {
try {
} catch (IOException e) {
throw new IOError(e);
}
}

boolean hasNext() {
while (!st.hasMoreTokens()) {
String s = nextLine();
if (s == null) {
return false;
}
st = new StringTokenizer(s);
}
return true;
}

String next() {
hasNext();
return st.nextToken();
}

int nextInt() {
return Integer.parseInt(next());
}

long nextLong() {
return Long.parseLong(next());
}

double nextDouble() {
return Double.parseDouble(next());
}
}

posted @ 2019-09-13 00:06  Inko  阅读(71)  评论(0编辑  收藏