是!!
是!!!!!
是!!!!!!!!
你妹啊
题目描述:
据说一个人的标准体重应该是其身高(单位:厘米)减去100、再乘以0.9所得到的公斤数。真实体重与标准体重误差在10%以内都是完美身材(即 |真实体重-标准体重| < 标准体重x10%)。已知1市斤=0.5公斤。现给定一群人的身高和实际体重,请你告诉他们是否太胖或太瘦了。
输入格式:
输入第一行给出一个正整数N(<= 20)。随后N行,每行给出两个整数,分别是一个人的身高H(120 < H < 200;单位:厘米)和真实体重W(50 < W <= 300;单位:市斤),其间以空格分隔。
输出格式:
为每个人输出一行结论:如果是完美身材,输出“You are wan mei!”;如果太胖了,输出“You are tai pang le!”;否则输出“You are tai shou le!”。
输入样例:
3
169 136
150 81
178 155
输出样例:
You are wan mei!
You are tai shou le!
You are tai pang le!
emmm这个题其实难度也不大,但是我居然错了3次…懵逼
利用题中所给的式子计算出c,然后作差计算误差百分比
代码如下:
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int Max_N=1000010;
int main() {
ios::sync_with_stdio(false);
cin>>n;
while(n--){
cin>>a>>b;
c = (a-100)*1.8;
if(abs(b-c)<(c*0.1))
printf("You are wan mei!\n");
if((abs(b-c)>=(c*0.1))&&b<c)
printf("You are tai shou le!\n");
if((abs(b-c)>=(c*0.1))&&b>c)
printf("You are tai pang le!\n");
}
return 0;
}
直接把条件写进if里即可