- محدودیت زمان: ۱ ثانیه
- محدودیت حافظه: ۲۵۶ مگابایت
One of the SBU ACM teams, Triangulum wants to trip to Kanpur for an important regional contest. They should travel by bus and as you know it could be an incredibly boring trip. During their trip they need to take rest in some hotels. There are N hotels in the path of Tehran to Kanpur. They should choose some hotels to take a rest at (maybe more than one night), and finally they must rest at $N$’th hotel. If they travel for $D$ distances between two hotels they should tolerate $|D-144|$ unit of difficulties. Given distance of each hotel from Tehran, your task is to help them to choose some hotels in order to minimize total difficulties as much as possible.
For more clarification, see sample inputs and outputs.
ورودی
Your program will be tested on one or more test cases. The first line of the input will be a single integer $T(T \le 30)$, the number of test cases. The first line of each test case will contain integers $N$, the number of hotels. Next line contains $N$ space separated integer numbers, each indicating $D_i$ , distance from Tehran to $i$’th hotel (in increasing order).$D_i < 10000$ and $N ≤ 20$.
خروجی
For each test case print a single line containing minimum total difficulties.
مثالها
ورودی نمونه ۱
3
1
10
2
120 144
4
10 14 20 21
خروجی نمونه ۱
134
0
123
ارسال پاسخ برای این سؤال