subject

Cho một dãy có N số lần lượt là a1, a2, …., aN. Với hai phần tử bất kì đứng kề nhau ta tính hiệu của chúng (ai+1 - ai với 0 được với nhau thành một con số gọi là tổng chênh lệch của dãy số.
Yêu cầu: Hãy tìm cách sắp xếp dãy số sao cho có tổng chênh lệch là lớn nhất.
Dữ liệu vào: Từ file văn bản NUMARR. INP
 Dòng đầu tiên: ghi số nguyên dương N (N≤106)  Dòng thứ hai: ghi các số nguyên dương ai (ai ≤1018), mỗi số cách nhau một
khoảng trống
Dữ liệu ra: Ghi vào file văn bản NUMARR. OUT một số nguyên là tổng chênh lệch
lớn nhất của dãy số.
Ví dụ:
NUMARR. INP
5
4 7 3 15 9
NUMARR. OUT
12

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:30
What is a costume plot? why is it important to a film or theater production?
Answers: 2
question
Computers and Technology, 23.06.2019 12:50
Which syntax error in programming is unlikely to be highlighted by a compiler or an interpreter? a variable name misspelling a missing space a comma in place of a period a missing closing quotation mark
Answers: 1
question
Computers and Technology, 24.06.2019 17:30
When you type january in a cell, then copy it using the fill handle to the cells below and the data automatically changes to february, march, april, and so on, what is this feature called? auto fill automaticcopy monthfill textfill
Answers: 1
question
Computers and Technology, 24.06.2019 18:00
Your computer running windows 10 is doing some very strange things with the operating system. you are fairly certain it is not a hardware issue. you need to try to get further insight into what is going on within the operating system. which tool would be best-suited for this?
Answers: 1
You know the right answer?
Cho một dãy có N số lần lượt là a1, a2, …., aN. Với hai phần tử bất kì đứng kề nhau ta tính hiệu củ...
Questions
Questions on the website: 13722363