这道题的精度很搞人心态……我调了几乎一个下午,然后最后数据水到直接枚举就能爆艹过去。
累了,不搞了。
扔个爆艹代码。
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
double A, B, C, D, E, F;
double f(double x)
{
return A * sin(B * x + C) + D * cos(E * x + F);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> A >> B >> C >> D >> E >> F;
double ans = INFINITY;
for (int i = 1; i <= 1000000; i++) {
ans = min(ans, f(i));
}
cout << ans;
return 0;
}
共 1 条回复
laffey tql