Orig Description
Score : 100 points
Problem StatementGiven an integer a as input, print the value a + a^2 + a^3.
Constraints
1 \leq a \leq 10
a is an integer.
InputInput is given from Standard Input in the following format:
a
OutputPrint the value a + a^2 + a^3 as an integer.
Sample Input 12
Sample Output 114
When a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.
Print the answer as an input. Outputs such as 14.0 will be judged as incorrect.
Sample Input 210
Sample Output 21110
Extracted Specification
An integer a (1 ≤ a ≤ 10).
### Example Input:
```
2
```
### Function Signature:
Write a function f(a) that takes in the input.
def f(a: int):
'''
a: an integer
'''
Test Case Generator
Sure! Let's create a test case generator for the given problem statement where you need to compute \(a + a^2 + a^3\) for a given integer \(a\).
Here's the Python code for the test case generator:
```python
import random
def tcgen():
# Generate a random integer a within the given constraints
a = random.randint(1, 10)
return a
# Example usage:
test_case = tcgen()
print(f"Input: {test_case}")
# For verification purposes, compute the expected output
expected_output = test_case + test_case**2 + test_case**3
print(f"Output: {expected_output}")
```
This generator will produce a random integer \(a\) in the range \(1 \leq a \leq 10\), as specified in the problem constraints. The printed output includes the test input and the expected result based on the formula \(a + a^2 + a^3\).
You can run this code to generate multiple test cases and verify that the output matches the expected results.
Extract Arguments
def extract_arguments(fh):
a = int(fh.readline().strip())
return (a,)