Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: Max

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-13 19:48:43

#include <iostream>
using namespace std;

int calculate_height(int t){
    int i, result = 4, temp = 10;
    for (i=1; i<t; i++)
    {
        result += temp;
        temp +=6;
    }
    return result;
}

int main(){
    int t, result;
    cin >> t;
    if (t != 0 && t != 1)
        cout << calculate_height(t) << endl;
    else if (t == 0)
        cout << 0 << endl;
    else
        cout << 4 <<endl;
}