#include <iostream>
#include <cmath>
using namespace std;
int main() {
double f,a, b, c, x;
cin >> c >> a >> b >> x;
if (c < 0 && a != 0) {
f = ((-a * pow(x, 3) - b) / c);
}
else if (c > 0 && a == 0) {
f = (x - pow(a, 3) / (-c));
else {
f = a * x + 5 * b;
cout << f;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <cmath>
using namespace std;
int main() {
double f,a, b, c, x;
cin >> c >> a >> b >> x;
if (c < 0 && a != 0) {
f = ((-a * pow(x, 3) - b) / c);
}
else if (c > 0 && a == 0) {
f = (x - pow(a, 3) / (-c));
}
else {
f = a * x + 5 * b;
}
cout << f;
return 0;
}