2 条题解

  • 0
    @ 2025-5-10 11:56:29

    这题一点都不简单

    很多人都会这么写

    #include<bits/stdc++.h>
    using namespace std;
    const int N=1e5+5,INF=0x3f3f3f3f;
    typedef long long LL;
    double a,b,c;
    int main(){
    	cin>>a>>b>>c;
    	cout<<b;
    	return 0;
    }
    

    结果0分!

    原因是浮点数会输出很多0

    于是又有一些人用字符串

    #include<bits/stdc++.h>
    using namespace std;
    const int N=5e5+5,INF=0x3f3f3f3f;
    typedef long long LL;
    string a,b,c;
    int main()
    {
    	cin>>a>>b>>c;
    	cout<<b;
    	return 0;
    }
    

    结果50分

    原因是浮点数输出整数会有.0结尾

    所以

    ACcode

    using namespace std;
    const int N=5e5+5,INF=0x3f3f3f3f;
    typedef long long LL;
    string a,b,c;
    bool flag;
    int main()
    {
    	cin>>a>>b>>c;
    	for(int i=0;i<b.size();i++)if(b[i]=='.')flag = 1;
    	if(flag)cout<<b;
    	else cout<<b<<".0";
    	return O;
    }
    

    《不抄袭题解,共创美好Temenhu》

    信息

    ID
    3247
    时间
    1000ms
    内存
    256MiB
    难度
    8
    标签
    递交数
    25
    已通过
    5
    上传者