关于本题的若干问题
查看原帖
关于本题的若干问题
365654
封禁用户楼主2023/7/27 21:27

Question 1

这是本题 #3 的输入:

11 -0.998244353 1.4899310583818
-72.904599140644 67.001717998916 93.773554224846 -55.793191403459 -38.366589898599 9.444119273570 -62.323604790564 98.576260383561 99.292265109602 93.538987402101 45.167792642378 96.221938355388

我把它拖进了 Geogebra:

很明显,该函数(绿色)不满足题目要求。

建议改为:

11 0.998244353 1.4899310583818
-72.904599140644 67.001717998916 93.773554224846 -55.793191403459 -38.366589898599 9.444119273570 -62.323604790564 98.576260383561 99.292265109602 93.538987402101 45.167792642378 96.221938355388

Question 2

特判这个错误的数据后,暴力做法通过了本题:

#include<bits/stdc++.h>
using namespace std;
long double fs[16];
int k;
long double ca(long double x)
{
    long double ans=0;
    for(int i=k;i>=0;i--)
        ans*=x,ans+=fs[i];
    return ans;
}
const long double rg=1e-10;
int main()
{
    cin>>k;
    long double l,r;
    cin>>l>>r;
    for(int i=k;i>=0;i--)
        cin>>fs[i];
    cout<<fixed<<setprecision(12);
    long double lst=ca(l);
    if(l>=-0.998244354&&l<=-0.998244352)
    {
        cout<<1.285175919197;
        return 0;
    }
    for(long double x=l+0.000001;x<=r;x+=0.000001)
    {
        long double now=ca(x);
        if(now<=lst-rg)
        {
            cout<<x;
            return 0;
        }
        lst=now;
    }
    return 0;
}

提交记录:https://www.luogu.com.cn/record/117750621

Question 3

经测试,由于精度问题,本题的 3535 篇题解(以及上面的暴力做法)均无法通过下面的 hack 数据:

6 -2 1
-1 -6 -15 -20 -15 -6 -1

原式 =−(x+1)6=-(x+1)^6,故正确答案显然是:

-1.00000

这篇 和 这篇 题解甚至不能输出结果。

Question 4

综上,我重做了一个模板题来解决这些问题:

https://www.luogu.com.cn/problem/U319587

2023/7/27 21:27
加载中...