Orig Description
Circle
Write a program which calculates the area and circumference of a circle for given radius r.
Input
A real number r is given.
Output
Print the area and circumference of the circle in a line. Put a single space between them. The output should not contain an absolute error greater than 10-5.
Constraints
0 < r < 10000
Sample Input 1
2
Sample Output 1
12.566371 12.566371
Sample Input 2
3
Sample Output 2
28.274334 18.849556
Test Case Generator
Sure! Below is a test case generator for the given "Circle" problem statement:
```python
import random
import math
def tcgen():
# Generate a random radius r between 0 (exclusive) and 10000 (exclusive)
r = random.uniform(0.00001, 9999.99999)
# Calculate the area and circumference of the circle
area = math.pi * r * r
circumference = 2 * math.pi * r
# Format the output to ensure precision up to 10^-5
area = format(area, '.6f')
circumference = format(circumference, '.6f')
return r, area, circumference
# Example usage:
r, area, circumference = tcgen()
print(f"Radius: {r}")
print(f"Expected Output: {area} {circumference}")
```
This function generates a random radius `r` within the specified constraints, calculates the area and circumference of the circle, and formats the results to ensure that they do not contain an absolute error greater than \(10^{-5}\). The generated test cases can be used for testing solutions to the problem.
To generate multiple test cases or to integrate this into a larger testing framework, you can call `tcgen()` multiple times and collect the results.