本篇博客还在持续修改润色中~
敬请期待~
AtCoder题解|ABC 103A Task Scheduling Problem
题目信息 📚
【题目描述】
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 tasks.
【输入】
The input is given from Standard Input in the following format:
$A_{1}$ $A_{2}$ $A_{3}$
【输出】
Print the minimum total cost required to complete all the task.
【数据范围】
- All values in input are integers.
- $1 \leq A_1, A_2, A_3 \leq 100$
【输入样例1】
1 6 3
【输出样例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$.
【输入样例2】
11 5 5
【输出样例2】
6
【输入样例3】
100 100 100
【输出样例3】
0
【题目来源】
https://atcoder.jp/contests/abc103/tasks/abc103_a
题目解析 🍉
【题目分析】
【C++代码】