2472.The Distance of Triples

通过数:7提交数:10学校:清华大学保研机试真题 题目列表 标签
题目描述 The distance of triples $(a, b, c)$ is defined as $D(a, b, c) = a - b + b - c + c - a $. Given three non-empty integer sets $S1$, $S2$ and $S3$, find the minimum distance of all possible triples $(a, b, c)$ where $a \in S1$, $b \in S2$ and $c \in S3$. If multiple solutions exist, output the largest triple. 输入格式 The first line contains three positive integers $N1$, $N2$ and $N3$ (all $\leq 10^4$), representing the sizes of $S1$, $S2$ and $S3$ respectively. The next three lines contain the members of $S1$, $S2$ and $S3$ respectively. All numbers are distinct within each set and range $[-10^4, 10^4]$. Numbers are space-separated. 输出格式 Print "MinD(a,b,c)=d" where $(a, b, c)$ is the triple with minimum distance $d$. If multiple solutions exist, output the largest triple. 输入样例 4 4 6 0 9 -1 11 10 -2 5 11 -10 9 2 41 17 12 38 输出样例 MinD(11,11,12)=2
C
补全
点击调试按钮即可调试代码。

点击提交按钮即可提交代码。