이 튜토리얼에서는 시리즈 3, 12, 29, 54, 86, 128, 177, 234, …
이를 위해 번호가 제공됩니다. 우리의 임무는 특정 위치에서 주어진 시리즈에 대한 용어를 찾는 것입니다.
예시
#include <iostream>
#include <math.h>
using namespace std;
//calculating nth term of given series
int nthTerm(int n) {
return 4 * pow(n, 2) - 3 * n + 2;
}
int main() {
int N = 4;
cout << nthTerm(N) << endl;
return 0;
} 출력
54