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;
}

 

相关文章:

  • 2022-12-23
  • 2021-09-18
  • 2022-02-10
  • 2021-12-04
  • 2022-01-31
  • 2022-12-23
  • 2021-12-14
  • 2021-11-07
猜你喜欢
  • 2021-05-20
  • 2021-08-31
  • 2022-01-20
  • 2021-05-18
  • 2021-10-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案