102340: [AtCoder]ABC234 A - Weird Function
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Score : $100$ points
Problem Statement
Let us define a function $f$ as $f(x) = x^2 + 2x + 3$.
Given an integer $t$, find $f(f(f(t)+t)+f(f(t)))$.
Here, it is guaranteed that the answer is an integer not greater than $2 \times 10^9$.
Constraints
- $t$ is an integer between $0$ and $10$ (inclusive).
Input
Input is given from Standard Input in the following format:
$t$
Output
Print the answer as an integer.
Sample Input 1
0
Sample Output 1
1371
The answer is computed as follows.
- $f(t) = t^2 + 2t + 3 = 0 \times 0 + 2 \times 0 + 3 = 3$
- $f(t)+t = 3 + 0 = 3$
- $f(f(t)+t) = f(3) = 3 \times 3 + 2 \times 3 + 3 = 18$
- $f(f(t)) = f(3) = 18$
- $f(f(f(t)+t)+f(f(t))) = f(18+18) = f(36) = 36 \times 36 + 2 \times 36 + 3 = 1371$
Sample Input 2
3
Sample Output 2
722502
Sample Input 3
10
Sample Output 3
1111355571
Input
题意翻译
已知函数 $f(x) = x^2 + 2x + 3$,给定 $t$ 求 $f(f(f(t)+t+f(f(t)))$。 Translated by ShanCreeper.Output
分数:100分
问题描述
我们定义一个函数$f$为$f(x) = x^2 + 2x + 3$。
给定一个整数$t$,求$f(f(f(t)+t)+f(f(t)))$。
在这里,可以保证答案是一个不超过$2 \times 10^9$的整数。
约束
- $t$是一个在$0$和$10$(含)之间的整数。
输入
输入从标准输入按以下格式给出:
$t$
输出
以整数形式打印答案。
样例输入1
0
样例输出1
1371
答案的计算过程如下。
- $f(t) = t^2 + 2t + 3 = 0 \times 0 + 2 \times 0 + 3 = 3$
- $f(t)+t = 3 + 0 = 3$
- $f(f(t)+t) = f(3) = 3 \times 3 + 2 \times 3 + 3 = 18$
- $f(f(t)) = f(3) = 18$
- $f(f(f(t)+t)+f(f(t))) = f(18+18) = f(36) = 36 \times 36 + 2 \times 36 + 3 = 1371$
样例输入2
3
样例输出2
722502
样例输入3
10
样例输出3
1111355571