per nextum in unam tum XI conscribementis fac sic
vestibulo perlegementum da varo.
morde varo.
seqis cumula varum.
cis
per nextum in unam tum XI conscribementis fac sic
seqis decumulamenta da varo.
varum privamentum fodementum da aresulto.
varum tum III elevamentum tum V multiplicamentum da bresulto.
aresultum tum bresultum addementum da resulto.
si CD tum resultum non praestantiam fac sic
dictum sic f(%d) = %.2f cis tum varum tum resultum egresso describe.
novumversum egresso scribe.
cis
si CD tum resultum praestantiam fac sic
dictum sic f(%d) = MAGNA NIMIS! cis tum varum egresso describe.
novumversum egresso scribe.
cis
cis
Input
The input consists of several integers, one per line. Each integer is between -50 and 50, inclusive.Output
As described in the problem statement.Exampleinput
0 1 -2 -3 -4 -5 -6 -7 -8 -9 10
output
f(10) = MAGNA NIMIS! f(-9) = -3642.00 f(-8) = -2557.17 f(-7) = -1712.35 f(-6) = -1077.55 f(-5) = -622.76 f(-4) = -318.00 f(-3) = -133.27 f(-2) = -38.59 f(1) = 6.00 f(0) = 0.00
Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
vector<int> as(11);
for (int i = 0; i < 11; i++) {
cin >> as[i];
}
cout << fixed << setprecision(2);
for (int i = 10; i >= 0; i--) {
int v = as[i];
double a = sqrt(abs(v));
double b = v * v * v * 5;
double res = a + b;
if (res > 400) {
cout << "f(" << v << ") = MAGNA NIMIS!" << '\n';
} else {
cout << "f(" << v << ") = " << res << '\n';
}
}
return 0;
}
Related posts:
Jongmah
Transmitting Levels
Segment Tree
Gambling Nim
Little Artem and 2-SAT
Robots protection
Check whether a graph is bipartite
Hot is Cold
Dima and Game
The Values You Can Make
Fair
Dima and Horses
Elections
Xors on Segments
Arkady and a Nobody-men
TOF
Dima and Figure
Monopole Magnets
Flowers and Chocolate
Petr and Permutations
Radio stations
Let Them Slide
Memory for Arrays
Maximum flow - Push-relabel method improved
Adam and Tree
K-th order statistic in O(N)
Optimal Subsequences (Hard Version)
Summer Homework
Can Bash Save the Day?
Place Your Ad Here
Cheap Travel
Buy Low Sell High