7-3最佳情侣身高差

it2022-05-05  153

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; }

最新回复(0)