是不是我题目理解错了?
#include<bits/stdc++.h>
using namespace std;
int zf, a[10001], ax[10001], n = 1, cb, cbx, aax = -666666, aaxx, zj, in = 666666, s1, s2, s3, ss, inn;
int main()
{
cin >> zf;
cin >> cb >> cbx;
while(cin >> a[n] >> ax[n])
{
if(a[n] == -1 && a[n] == -1)
{
n--;
break;
}
if(a[n] < zf && a[n] > aax)aax = a[n], aaxx = ax[n];
n++;
}
double sasa = ax[n] + ((ax[n]-ax[n-1])*(zf-a[n])/(a[n]-a[n-1]));
cin >> zj;
double lax = sasa + ((aaxx-sasa)/(zf-aax));
int la = zf-1, fu = zf+1, fux = sasa-zj;
for(int i = -10000; i <= 10000; i++)
{
s1 = (la+i-cb)*lax;
s2 = (zf+i-cb)*sasa;
s3 = (fu+i-cb)*fux;
if(i < 0) ss = (0-i);
else ss = i;
if(s2 > s1 && s2 > s3 && ss < in)
{
in = ss;
inn = i;
}
}
if(in == 666666)cout << "NO SOLUTION" << endl;
else cout << inn << endl;
return 0;
}
是我太蒟蒻了还是我语文白学了?