我不李姐


私信TA

用户名:uq_19162528603

访问量:1419

签 名:

没被人肯定过

等  级
排  名 3042
经  验 1976
参赛次数 1
文章发表 10
年  龄 19
在职情况 学生
学  校 南京理工大学紫金学院
专  业 物联网

  自我简介:

没被人肯定过

解题思路:

注意事项:

参考代码:

#include<stdio.h>

#define _CRT_SECURE_NO_DEPRECATE

#pragma warning(disable:4996)

#define N 10

void Insert_Sort(int arr[],int len)

{

for (int i = 1; i < len; i++)

{

int t = i;

int value = arr[i];

while (t > 0 && arr[t - 1] > value)

{

arr[t] = arr[t - 1];

t = t - 1;

}

arr[t] = value;

}

}


int main()

{

int arr[1000];

int n;

scanf("%d", &n);

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

{

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

}


Insert_Sort(arr,n);


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

{

printf("%d ", arr[i]);

}

printf("\n");






return 0;

}


 

0.0分

0 人评分

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

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区