您的位置:首页 > 其它

HDU 1985 Conversions

2012-05-25 05:08 155 查看
http://acm.hdu.edu.cn/showproblem.php?pid=1985

小学计算题

View Code

#include <iostream>
#include <string>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
for(int cas=1;cas<=t;cas++)
{
double n;
string d;
cin >> n >> d;
if(d=="kg")
printf("%d %.4lf lb\n",cas,n*2.2046);
else if(d=="lb")
printf("%d %.4lf kg\n",cas,n*0.4536);
else if(d=="g")
printf("%d %.4lf l\n",cas,n*3.7854);
else if(d=="l")
printf("%d %.4lf g\n",cas,n*0.2642);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: