Tính tổng 1

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à đề Traning Python

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

~S~ = ~1~ + ~2~ + ~3~ + ... + ~n~

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

Input

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

Output

Giá trị của ~S~

Examples

Input

3

Output

6

Comments

Please read the guidelines before commenting.



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

    include<bits/stdc++.h>

    using namespace std; long long S,n,SSH; int main() { cin >> n; SSH=(n-1)/1+1; S=(1+n)*SSH/2; cout<<S<<endl> </endl>