AtCoder Beginner Contest 234 A - Weird Function
問題の要約
関数fをf(x)=x^2+2*x+3と定義する。
整数tが入力されるので、f(f(f(t)+t)+f(f(t)))を求めよ。
ただし、答えは2*10^9以下の整数であることが保証される。
制約
0<=t<=10
入力
t
考え方
1,関数を作り、それにtを代入して答えを出力。
実際のプログラム
#include<iostream>
using namespace std;
long long f(long long x){
return x*x+2*x+3;
}
int main(){
long long t;
cin >> t;
long long ans = f(f(f(t)+t)+f(f(t)));
cout << ans << endl;
return 0;
}