-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathherman.cpp
42 lines (34 loc) · 893 Bytes
/
herman.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* @file herman.cpp
* @author William Weston
* @brief
* @version 0.1
* @date 2023-06-13
*
* @copyright Copyright (c) 2023
*
* Source: https://open.kattis.com/problems/herman
*/
#include <cstdlib>
#include <iomanip>
#include <iostream>
auto area( int radius ) noexcept -> void;
auto
main() -> int
{
int radius;
while ( std::cin >> radius )
{
area( radius );
}
return EXIT_SUCCESS;
}
auto
area( int radius ) noexcept -> void
{
static constexpr long double pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679;
std::cout << std::setw(24) << std::fixed << std::setprecision( 6 ) << std::showpoint
<< pi * radius * radius << '\n';
std::cout << std::setw(24) << std::fixed << std::setprecision( 6 ) << std::showpoint
<< 2.0 * radius * radius << '\n';
}