Description
已知元素从小到大排列的两个数组x[]和y[],请写出一个程序算出两个数组彼此之间差的绝对值中最小的一个,这叫做数组的距离。
Input
第一行为两个整数m, n(1≤m, n≤1000),分别代表数组f[], g[]的长度。 第二行有m个元素,为数组f[]。 第三行有n个元素,为数组g[]。
Output
数组的最短距离
Sample Input
5 5
1 2 3 4 5
6 7 8 9 10
Sample Output
1
#include <stdio.h>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int m = 0;
int n = 0