Độ dài phủ

View as PDF

Submit solution

Points: 100.00 (partial)
Time limit: 1.0s
Memory limit: 1G
Input: stdin
Output: stdout

Author:
Problem type
Allowed languages
C, C++, GAS64, Pascal, Perl, PHP, Python, Sed, TCL, Text

Trên trục số cho dãy n đoạn thẳng, đoạn thứ i có toạ độ điểm đầu là số nguyên xi , chiều dài nguyên dương di.

  • |xi| < 105
  • |di|< 1000
  • 1<=N<= 106

Hãy tính độ dài L trên trục số phủ bởi n đoạn thẳng trên.

Input có dạng:

3

x1.. xn

d1.. dn

Output: Ghi ra độ dài L

Ví dụ:
Input
Copy
3
0 -1 1
2 1 1
Output
Copy
3

Comments

Please read the guidelines before commenting.



  • -2
    anhtuan2007  commented 5:59:17 pm, 08/11/2022

    tai sao lai sai test cuoi nhi?


    • 3
      baptienti26  commented 12:25:32 am, 16/11/2022

      do em non thoi