Task Scheduling Problem

AtCoder
IDabc103_a
Time2000ms
Memory256MB
Difficulty
You have three tasks, all of which need to be completed. First, you can complete any one task at cost $0$. Then, just after completing the $i$\-th task, you can complete the $j$\-th task at cost $|A_j - A_i|$. Here, $|x|$ denotes the absolute value of $x$. Find the minimum total cost required to complete all the task. ## Constraints * All values in input are integers. * $1 \leq A_1, A_2, A_3 \leq 100$ ## Input Input is given from Standard Input in the following format: $A_1$ $A_2$ $A_3$ [samples]
Samples
Input #1
1 6 3
Output #1
5

When the tasks are completed in the following order, the total cost will be $5$, which is the minimum:

*   Complete the first task at cost $0$.
*   Complete the third task at cost $2$.
*   Complete the second task at cost $3$.
Input #2
11 5 5
Output #2
6
Input #3
100 100 100
Output #3
0
API Response (JSON)
{
  "problem": {
    "name": "Task Scheduling Problem",
    "description": {
      "content": "You have three tasks, all of which need to be completed. First, you can complete any one task at cost $0$. Then, just after completing the $i$\\-th task, you can complete the $j$\\-th task at cost $|A_j",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc103_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You have three tasks, all of which need to be completed.\nFirst, you can complete any one task at cost $0$.\nThen, just after completing the $i$\\-th task, you can complete the $j$\\-th task at cost $|A_j...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments