QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 256 MB Toplam puan: 100

#22784. Núi hùng vĩ

İstatistikler

Các bò nghỉ hè gần Front Range thuộc Rocky Mountains, không xa nhà Coach Rob. Trên đường chân trời thấy $N$ núi ($N \le 100{,}000$), ví dụ (ở đây $N=5$):

                   /\
      /\          /  \  /\
     /  \/\    /\/    \/  \
    /    \ \  /  \    /    \
  -----------------------------

Mỗi núi là tam giác cân có chiều cao đúng gấp đôi độ dài đáy. Núi được mô tả bằng tọa độ $x$ của hai đầu đáy; đây là các số nguyên dương vừa trong số có dấu16 bit. Hãy tính tổng diện tích hợp của các núi.

Dữ liệu vào

  • Dòng 1: số nguyên $N$.
  • Các dòng $2..N+1$: mỗi dòng mô tả một núi bằng hai số nguyên đã sắp xếp, cách nhau dấu cách.

Dữ liệu ra

Một số nguyên, diện tích hợp của các núi. Diện tích luôn nguyên và vừa trong số có dấu32 bit.

Ví dụ

Dữ liệu vào 1

5
2 7
6 9
12 15
14 21
20 25

Dữ liệu ra 1

114

Tác giả bài toán: Brian Dean, 2001

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.