#include <stdio.h>

int main() { int n; scanf("%d", &n); double height; char gender; double bestHeight; for (int i = 0; i < n; i++) { scanf(" %c %lf", &gender, &height); if (gender == 'M') { bestHeight = height * 1.09; } else { bestHeight = height / 1.09; } printf("%.2f\n", bestHeight); } return 0; }

编写一个C语言代码为任意一位用户计算他她的情侣的最佳身高。输入格式:输入第一行给出正整数N≤10为前来查询的用户数。随后N行每行按照性别 身高的格式给出前来查询的用户的性别和身高其中性别为F表示女性、M表示男性;身高为区间 10 30 之间的实数。输出格式:对每一个查询在一行中为该用户计算出其情侣的最佳身高保留小数点后2位。输入样例:2M 175F 18输出样例:161196

原文地址: https://www.cveoy.top/t/topic/hmXa 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录