TPK algorithm: Difference between revisions

Content deleted Content added
Implementations: C++ added.
Line 91:
 
return 0;
}
</source>
 
===[[C++]]===
<source lang="c++">
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
 
double f(double x) {
return sqrt(fabs(x)) + 5*x*x*x;
}
 
int main() {
const int N = 11;
vector<int> vals(N);
for(int i = 0; i < N; ++i)
cin >> vals[i];
for(int i = N - 1; i >= 0; --i) {
double x = f(vals[i]);
(x > 400 ? cout << "TOO LARGE" : cout << x) << endl;
}
}
</source>