F(153) = F(152) + 153 = F(151) + 152 + 153 = F(150) + 151 + 152 + 153 = ... = F(1) + 2 + 3 + ... + 153 = 1 + 2 + 3 + ... + 153 = 153 * 154 / 2 = 11781
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double r, s, c;
cin >> r;
s = M_PI*r*r;
c = 2*M_PI*r;
cout.setf(ios::fixed);
cout.precision(3);
cout << s << "\n" << c << "\n";
return 0;
}
Пример:
5
<span>78.540
31.416</span>