L1-040 最佳情侣身高差 (10 分)
import java.util.Scanner;
/*
*@author 曹家伟
*/
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s=new Scanner(System.in);
int n=s.nextInt();
String ch[]=new String[n];
double a[]=new double[n];
for(int i=0;i<n;i++) {
ch[i]=s.next();
a[i]=s.nextDouble();
}
// char ch[]=
int p=0;
for(int i=0;i<n;i++) {
char ch1[]=ch[i].toCharArray();
if(p<n-1) {
if(ch1[0]=='M') {
double x=a[i]/1.09;
System.out.println(String.format("%.2f", x));
}
else {
double y=a[i]*1.09;
System.out.println(String.format("%.2f", y));
}}
else {
if(ch1[0]=='M') {
double x=a[i]/1.09;
System.out.print(String.format("%.2f", x));
}
else {
double y=a[i]*1.09;
System.out.print(String.format("%.2f", y));
}
}
p++;
}
}
}
浙公网安备 33010602011771号