您的位置:首页 > 其它

到底是不是太胖了(卡精度)

2017-03-24 17:16 120 查看
这个题用double 的话,会卡点精度。。最后一组总是错

然后。。。以后转化为int 来比较好了

#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
int n;
scanf("%d",&n);
while(n--)
{
int h,w;
cin>>h>>w;
int ans=(h-100)*2*1000*9/10;
int l=ans*9/10;
int r=ans*11/10;
w=w*1000;
if(w>l&&w<r)
printf("You are wan mei!\n");
else if(w<=l) printf("You are tai shou le!\n");
else if(w>=r) printf("You are tai pang le!\n");
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: