Hàng gạch

View as PDF

Submit solution

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

Problem type
Allowed languages
Python, Scratch

Có ~N~ hàng gạch, hàng đầu tiên có ~A~ viên gạch. Biết hàng sau hơn hàng trước ~B~ viên. Hỏi để xếp được ~N~ hàng gạch đó người ta đã dùng bao nhiêu viên gạch?

Input Specification

  • Dòng 1 chứa số nguyên ~N~ ~(1 \le N \le 10^{9})~
  • Dòng 2 chứa số nguyên ~A~ ~(1 \le A \le 20)~
  • Dòng 3 chứa số nguyên ~B~ ~(1 \le B \le 20)~

Output Specification

Một dòng chứa kết quả bài toán

Sample Input

5
1
1

Sample Output

15

Comments

Please read the guidelines before commenting.



  • 0
    baohoa200  commented on May 5, 2025, 1:30 p.m.

    n = int(input()) a = int(input()) b = int(input()) sc = a + (n-1)b s = (a+sc)n//2 print(s) phan test


  • 0
    baohoa200  commented on May 5, 2025, 1:19 p.m.

    khanhhung32014 đã bình luận 3:11:42 ch, 19/04/2025 làm sai rồi


  • -4
    khanhhung32014  commented on April 19, 2025, 8:11 a.m.

    code cho các bạn tham khảo nhé!!!

    def viengach(n,a,b):

    s = n * (2 * a + (n - 1) * b) // 2
    
    return s
    

    n = int(input())

    a = int(input())

    b = int(input())

    print(viengach(n,a,b))


  • -5
    khanhhung32014  commented on April 19, 2025, 8:01 a.m.

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


  • -5
    khanhhung32014  commented on April 19, 2025, 7:59 a.m.

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


  • -7
    Minh_Pham  commented on April 18, 2025, 1:42 p.m.

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


  • -5
    KhangKD2025  commented on April 18, 2025, 9:18 a.m.

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


  • -5
    Minh_Pham  commented on April 15, 2025, 3:15 p.m.

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


  • -4
    nguyenkhang2008  commented on April 5, 2025, 6:05 a.m.

    ê , cho mình xin cái code đi