Liamcoder


私信TA

用户名:18817572995

访问量:9580

签 名:

Where there is a will, there is a way.

等  级
排  名 1877
经  验 2487
参赛次数 2
文章发表 11
年  龄 0
在职情况 学生
学  校 上海师范大学
专  业 计算机科学与技术

  自我简介:

屌丝程序狗

#include<stdio.h>

int go(int x[], int y[]);

int juedui(int s);

int main()

{

int x[1000], y[1000];

int m, n;

scanf("%d%d", &m, &n);

for(int i=0; i<m; i++)

{

scanf("%d", &x[i]);

}

for(int i=0; i<n; i++)

{

scanf("%d", &y[i]);

}

int value = go(x, y);

printf("%d", value);

return 0;


int go(int x[],int y[])  

{  

    int t,min=9999;  

    for(int l=0; x[l]; l++)  

    {  

        for(int k=0; y[k]; k++)  

        {  

            t=juedui(y[k]-x[l]);  

            if(t<min)  

            {  

                min=t;  

            }  

        }  

    }  

    return min;  

  

}  

int juedui(int s)

{  

    int c=s;  

    if(s<0)  

    {  

        c=-s;  

    }  

    return c;  

}  


 

0.0分

1 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区