TÍNH TỔNG DÃY SỐ

View as PDF

Submit solution

Points: 100.00 (partial)
Time limit: 1.0s
Memory limit: 512M
Input: stdin
Output: stdout

Problem type
Allowed languages
Python, Scratch

In case the statement didn't load correctly, you can download the statement here: Statement


Comments

Please read the guidelines before commenting.



  • 0
    donakhoa_nhd   commented on Aug. 21, 2024, 10:40 a.m.

    if M % 2 == 0: tong = (M // 2) * (N + 1) else: tong = (M // 2) * (N + 1) + (M + 1) // 2


  • 0
    tn   commented on July 2, 2024, 11:32 p.m.

    code : n=int(input()) m=int(input()) total=(n+1)*(m>>1)

    m&1==m%2

    if(m&1): total+=(m>>1)+1 print(total)


  • 1
    nguyentuantuat2   commented on July 1, 2024, 2:27 p.m.

    cứu mình với, mình làm trên scratch ra kết quả nhanh lắm mà lại bị nói là quá thời gian


  • -1
    tung123   commented on June 8, 2024, 10:37 p.m.

    40 diem

    n=int(input()) m=int(input()) l=[1, n, 2, (n - 1), 3, (n - 2)] t=0 if n%2==0 and 1<=m<=n<=10**9: for i in range(1, m+1): t+=l[i-1] print(t)


  • 1
    tung123   commented on June 8, 2024, 9:57 a.m.

    Code ne

    N = int(input("Nhap so N:")) M = int(input("Nhap so M:")) if M%2==0: a = m/2 T = a(N+1) else: a = (M-1)/2 T = (a(N+1))+((M+1)/2) print(T)


  • 1
    Tony_ankhanh1234   commented on June 6, 2024, 4:04 p.m.

    https://scratch.mit.edu/projects/1030960813/editor/ tự xem đi


  • 6
    phungxuanlam   commented on June 5, 2024, 3:45 p.m.

    https://drive.google.com/file/d/1QbJzRf0UWVpYhw4n6pBD5TsiCI50nNxQ/view tham khảo nha


  • 0
    KhiemNguyen   commented on June 5, 2024, 3:28 p.m.

    N=int(input()) M=int(input()) if M==1:print(1) elif M%2==1:print((M//2+2)(M//2+1)//2+(2N-M//2+1)(M//2)//2) else:print((1+M//2)(M//2)//2+(2N-M//2+1)(M//2)//2)


  • 2
    Thanh_Tung_238   commented on May 27, 2024, 3:22 a.m.

    a=int(input()) b=int(input()) tong=0 for i in range(a+1,b): if (i%2==0) and (i%3!=0): tong=tong+i print(tong) Test cuối vì sao quá thời gian


    • 0
      Clermono   commented on June 4, 2024, 4:28 p.m.

      nên dùng sum() đó


  • 4
    bynk2311   commented on May 22, 2024, 5:22 p.m.

    cho mình xin test 5 với ạ


  • -9
    Bongu   commented on May 7, 2024, 3:49 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -13
    Bongu   commented on May 7, 2024, 3:49 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -13
    Bongu   commented on May 7, 2024, 3:49 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • 22
    Chiie   commented on April 29, 2024, 3:33 p.m.

    Làm thế nào vậy mn ?