L1 | 您所在的位置:网站首页 › 约克夏太胖了 › L1 |
作者 陈越 单位 浙江大学 据说一个人的标准体重应该是其身高(单位:厘米)减去100、再乘以0.9所得到的公斤数。真实体重与标准体重误差在10%以内都是完美身材(即 | 真实体重 − 标准体重 | h >> real; double stand = (h - 100) * 0.9*2; people.push_back(make_pair(stand, real)); } 接着进行计算比较即可,注意输出情况即可。 完整代码: #include #include #include #include using namespace std; int main() { int n; cin >> n; vector people; for (int i = 0; i < n; i++) { double h, real; cin >> h >> real; double stand = (h - 100) * 0.9*2; people.push_back(make_pair(stand, real)); } for (int i = 0; i < n; i++) { if (fabs(people[i].second - people[i].first)< 0.1* people[i].first) {//体重差值在10%的标准体重阈值范围内 cout |
CopyRight 2018-2019 实验室设备网 版权所有 |