P8823 [传智杯 #3 初赛] 期末考试成绩

#include 
#define bug printf("************************\n");
#define fuck(x) cout << #x << " -> " << x << endl
#define endl '\n'
using namespace std;
constexpr int N = 1e6, inf = 0x3f3f3f3f;
double ans;

void one(int x)
{
    double maxx = 4.0;
    if (x >= 90)
    {
        cout << fixed << setprecision(1) << maxx << endl;
        return;
    }
    else if (x <= 89 && x >= 60)
    {
        int num = 90 - x;
        double price = num * 0.1;
        maxx -= price;
    }
    else if (x < 60)
    {
        cout << "0.0" << endl;
        return;
    }
    cout << fixed << setprecision(1) << maxx << endl;
}
void solve()
{
    int x;
    cin >> x;
    if (x < 60)
    {
        ans = sqrt(x);
        ans *= 10;
        one(ans);
    }
    else
        one(x);
}

signed main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    solve();

    return 0;
}

你可能感兴趣的:(c++,算法,开发语言)