7-3 最佳情侣身高差
原创
©著作权归作者所有:来自51CTO博客作者tizzi的原创作品,请联系作者获取转载授权,否则将追究法律责任
import java.text.DecimalFormat;
import java.util.Scanner;
public class S7_03 {
static int n;
static String c;
static double h;
public static void main(String[] args) {
DecimalFormat df = new DecimalFormat("0.00");
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
while (n-- > 0) {
c = sc.next();
h = sc.nextDouble();
if (c.equals("F")) {
System.out.println(df.format(h * 1.09));
} else {
System.out.println(df.format(h / 1.09));
}
}
}
}
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
int n;
double high;
char c;
cin>>n;
while(n--){
cin>>c>>high;
if(c=='M'){
cout<<setprecision(2)<<fixed<<high/1.09<<endl;
}
else cout<<setprecision(2)<<fixed<<high*1.09<<endl;
}
return 0;
}