(SPOJ) 2606 - Frota de Táxi - Solução
import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
Main processando = new Main();
processando.processa();
System.exit(0);
}
void processa() throws NumberFormatException, IOException {
Scanner scan = new Scanner(System.in);
String line = scan.nextLine();
StringTokenizer tokenizer = new StringTokenizer(line);
Double pGasolina = Double.parseDouble(tokenizer.nextToken())*100;
Double pAlcool = Double.parseDouble(tokenizer.nextToken())*100;
Double gPLitro = Double.parseDouble(tokenizer.nextToken())*100;
Double aPLitro = Double.parseDouble(tokenizer.nextToken())*100;
if (gPLitro/pGasolina <= aPLitro/pAlcool) {
System.out.println("G");
}
else {
System.out.println("A");
}
return;
}
}
import java.util.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
Main processando = new Main();
processando.processa();
System.exit(0);
}
void processa() throws NumberFormatException, IOException {
Scanner scan = new Scanner(System.in);
String line = scan.nextLine();
StringTokenizer tokenizer = new StringTokenizer(line);
Double pGasolina = Double.parseDouble(tokenizer.nextToken())*100;
Double pAlcool = Double.parseDouble(tokenizer.nextToken())*100;
Double gPLitro = Double.parseDouble(tokenizer.nextToken())*100;
Double aPLitro = Double.parseDouble(tokenizer.nextToken())*100;
if (gPLitro/pGasolina <= aPLitro/pAlcool) {
System.out.println("G");
}
else {
System.out.println("A");
}
return;
}
}
Comments
Post a Comment