Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: ChanakanStudy

Problemset: นักบินอวกาศ

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-10 23:27:14

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <numeric>
#include <iomanip>
using namespace std;
using ll = long long;

ll astro(ll n) {
    if(n==0) {
        return 0;
    }
    if(n == 1) {
        return 4;
    }
    if(n ==2 ) {
        return 14;
    }
    else {
        return (6*n) + (astro(n-1) - 2);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    cout << astro(n);

    return 0;
}