P8823题解

· · 题解

题目大意:

思路:

题目已经说的很清楚了,其实就是要用几个 if 来判断。

code:

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int x,ans;
    cin>>x;
    if(x>90)cout<<"4.0"<<endl;
        else if (x>=60)printf("%.1lf\n",4.0-(90.0 - x)/10.0);
        else 
        {
        ans=floor(sqrt(x)*10);
        if(x>90)cout<<"4.0"<<endl;
                else if(x>=60)printf("%.1lf",4.0-(90.0-x)/10.0);
        else cout<<"0.0"<<endl;
    }
        return 0;
}

AC记录。