不要过于沉溺过去,也不要过于畅想未来,把握现在!

编程之美预赛A题

复制代码
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
double ans;
void yuan1(string s)
{
    if(s=="m") ans=ans*1000;
    if(s=="dm") ans=ans*100;
    if(s=="cm") ans=ans*10;
    if(s=="um") ans=ans*0.001;
    if(s=="nm") ans=ans*1e-6;
}
void yuan2(string s)
{
    if(s=="m") ans=ans/1000;
    if(s=="dm") ans=ans/100;
    if(s=="cm") ans=ans/10;
    if(s=="um") ans=ans/0.001;
    if(s=="nm") ans=ans/1e-6;
}
int main()
{
    int cnt=1;
    int t;
    string s1,s2,s3;
    double a,b,c;
    scanf("%d",&t);
    while(t--){
        cin>>a>>s1>>b>>s2>>c>>s3;
        //cout<<s1<<" "<<s2<<" "<<s3<<" "<<endl;
        ans=a*c/b;
        //cout<<ans<<endl;
        yuan1(s1);
        yuan2(s2);
        printf("Case %d: %.2lfpx\n",cnt++,ans);
    }
    return 0;
}
复制代码

 

posted @   coding_yuan  阅读(176)  评论(0编辑  收藏  举报
编辑推荐:
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
· 一次Java后端服务间歇性响应慢的问题排查记录
· dotnet 源代码生成器分析器入门
· ASP.NET Core 模型验证消息的本地化新姿势
阅读排行:
· 开发的设计和重构,为开发效率服务
· ThreeJs-16智慧城市项目(重磅以及未来发展ai)
· 从零开始开发一个 MCP Server!
· .NET 原生驾驭 AI 新基建实战系列(一):向量数据库的应用与畅想
· Ai满嘴顺口溜,想考研?浪费我几个小时

不要过于沉溺过去,也不要过于畅想未来,把握现在!

点击右上角即可分享
微信分享提示