Tổng A đến B

View as PDF

Submit solution

Points: 1.00 (partial)
Time limit: 1.0s
Memory limit: 256M
Input: stdin
Output: stdout

Author:
Problem type
Allowed languages
Python, Scratch

Cho dãy số có dạng như sau ~1,2,5,10,17,26...~ Nhập vào 2 số ~A~ và ~B~. Hãy tính tổng các số trong dãy nằm trong phạm vi từ ~A~ đến ~B~.

Dữ liệu
  • Dòng thứ nhất chứa số ~A~
  • Dòng thứ hai chứa số ~B~ ~(1 \le A \le B \le 10^9)~
Kết quá
  • Một số nguyên là kết quả bài toàn
Sample Input
3
12
Sample Output
15
Note
  • Các số trong dãy trong phạm vi từ ~3~ đến ~12~ là ~5~ và ~10~, tổng ~5 + 10 = 15~.

Comments

Please read the guidelines before commenting.



  • -1
    anhkiet1306  commented on May 12, 2025, 11:41 a.m.

    Mỗi dữ liễu nhập trên một dòng nhé


    • 0
      anhkiet1306  commented on May 12, 2025, 12:03 p.m.

      Ai vote vậy


  • -3
    Kaiser  commented on April 21, 2025, 1:04 p.m.

    .


  • -8
    nthai6  commented on April 21, 2025, 11:29 a.m.

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


  • -3
    Panh2014  commented on April 21, 2025, 11:27 a.m.

    like


  • -7
    Ngodinhtuanlam  commented on April 20, 2025, 2:35 a.m.

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


    • -3
      Sae  commented on April 22, 2025, 8:25 a.m.

      ...


  • -1
    buiducduy2014  commented on April 20, 2025, 2:16 a.m.

    thanks bạn


  • -4
    ngominhnhat  commented on April 20, 2025, 2:16 a.m.

    A = int(input()) B = int(input())

    d = 1 i = 1

    tong = 0 while d <= B: if d >= A: tong += d d += 2 * i - 1 i += 1

    print(tong) code cho mọi ngừoi nè


  • -13
    baon27793  commented on April 19, 2025, 2:44 a.m.

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


  • -12
    baon27793  commented on April 19, 2025, 2:43 a.m.

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


  • -12
    baon27793  commented on April 19, 2025, 2:20 a.m.

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


  • -12
    Sae  commented on April 17, 2025, 1:24 p.m.

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


  • -8
    Trinhnguyendangkhoa  commented on April 17, 2025, 12:15 p.m.

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


  • -11
    thutracutis1tg  commented on April 13, 2025, 9:21 a.m.

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


  • -12
    thutracutis1tg  commented on April 13, 2025, 9:21 a.m.

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


  • -12
    Vuong5c  commented on April 13, 2025, 9:20 a.m.

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


  • -11
    kimanhtink10  commented on April 13, 2025, 9:20 a.m.

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


  • -9
    Vuong5c  commented on April 13, 2025, 9:20 a.m.

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


  • -9
    kimanhtink10  commented on April 13, 2025, 9:19 a.m.

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


  • -9
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -10
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -9
    kimanhtink10  commented on April 13, 2025, 9:19 a.m.

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


  • -11
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -7
    thutracutis1tg  commented on April 13, 2025, 9:19 a.m.

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


  • -8
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -7
    kimanhtink10  commented on April 13, 2025, 9:19 a.m.

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


  • -8
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -7
    thutracutis1tg  commented on April 13, 2025, 9:19 a.m.

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


  • -7
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -7
    kimanhtink10  commented on April 13, 2025, 9:19 a.m.

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


  • -6
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -6
    thutracutis1tg  commented on April 13, 2025, 9:19 a.m.

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


  • -7
    kimanhtink10  commented on April 13, 2025, 9:19 a.m.

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


  • -7
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -9
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -6
    thutracutis1tg  commented on April 13, 2025, 9:19 a.m.

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


  • -8
    kimanhtink10  commented on April 13, 2025, 9:19 a.m.

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


  • -8
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -9
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -6
    kimanhtink10  commented on April 13, 2025, 9:19 a.m.

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


  • -7
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -5
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -6
    kimanhtink10  commented on April 13, 2025, 9:19 a.m.

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


  • -10
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -9
    Vuong5c  commented on April 13, 2025, 9:19 a.m.

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


  • -6
    kimanhtink10  commented on April 13, 2025, 9:19 a.m.

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


  • -8
    thutracutis1tg  commented on April 13, 2025, 9:19 a.m.

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


  • -14
    Thetinh15  commented on March 24, 2025, 9:04 a.m.

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