Tính tổng 3

View as PDF

Submit solution

Points: 0.10
Time limit: 0.1s
Memory limit: 64M
Input: stdin
Output: stdout

Author:
Problem type

Giới thiệu: Đây là đề Training Python

Viết chương trình tính ~S~ biết rằng:

~S = (2 + 3 + 4 + ... + n) + 2n~

Trong đó, ~n~ là số nguyên dương nhập từ bàn phím, ~n\ge2~

Input

Số nguyên dương ~n~

Output

Giá trị ~S~

Examples

Input

3

Output

11

Comments

Please read the guidelines before commenting.



  • 0
    Quando  commented on July 30, 2025, 2:57 p.m.

    include<iostream>

    using namespace std; long long n; int main() { cin >> n; cout << (n+2)(n-1)/2 + 2n; return 0; }


  • -2
    nguyencongtamn78  commented on July 24, 2025, 1:12 p.m.

    include <iostream>

    long long a; using namespace std; int main() { cin>>a; cout<<a(a+1)/2+2a; }