5 条题解

  • 5
    @ 2022-7-12 7:18:00
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n,b=0,a[1001];
    	cin>>n;
    	for(int i=0;i<n;i++)
    	{
    		cin>>a[i];
    		b++;
    	}
    	sort(a,a+n);
    	for(int j=0;j<=n-1;j++)
    	{
    		cout<<a[j]<<endl;
    	}
    }
    
    • 2
      @ 2023-9-29 14:09:04

      Python的哦~

      aaa=input()
      x=input().split()
      for i in range(len(x)):
          for j in range(len(x)):
              if int(x[i])<int(x[j]):
                  x[j],x[i]=x[i],x[j]
      for i in range(len(x)):
          print(x[i])
      
    • 1
      @ 2022-11-3 19:04:49

      #include <bits/stdc++.h>

      using namespace std; int a[2000]; int main() { int n; string m; cin>>n; for(int i=0;i<n;i++){cin>>a[i];} sort(a,a+n); for(int b=0;b<n;b++){cout <<a[b]<<endl;}

      }

      • 1
        @ 2022-11-3 19:04:17

        #include <bits/stdc++.h>

        using namespace std; int a[2000]; int main() { int n; string m; cin>>n; for(int i=0;i<n;i++){cin>>a[i];} sort(a,a+n); for(int b=0;b<n;b++){cout <<a[b]<<endl;}

        }

        • 1
          @ 2022-10-9 13:17:38

          C语言单向链表插排

          #include <stdlib.h>
          #include <stdio.h>
          
          typedef struct _List {
          	int num;
          	struct _List *ne;
          } List; //节点结构体
          
          int n;
          List *head = NULL, *tail = NULL;
          
          void init(int x) {
          	List *temp = (List*)malloc(sizeof(List));
          	temp -> num = x;
          	temp -> ne = NULL;
          	head = tail = temp;
          } //链表初始化(第一个节点)
          
          void insert_to_head(int x) {
          	List *temp = (List*)malloc(sizeof(List));
          	temp -> num = x;
          	temp -> ne = head;
          	head = temp;
          } //头部插入
          
          void insert_to_tail(int x) {
          	List *temp = (List*)malloc(sizeof(List));
          	temp -> num = x;
          	temp -> ne = NULL;
          	tail -> ne = temp;
          	tail = temp;
          } //尾部插入
          
          void insert(int x, List *y) {
          	List *temp = (List*)malloc(sizeof(List));
          	temp -> num = x;
          	temp -> ne = y -> ne;
          	y -> ne = temp;
          } //在y节点后插入
          
          int main()
          {
          	scanf("%d", &n);
          	for(int i = 1, x; i <= n; i++) {
          		scanf("%d", &x);
          		if(i == 1) init(x);
          		else {
          			List *pr = NULL, *temp;
          			for(temp = head; temp != NULL; temp = temp -> ne) {
          				if(temp -> num > x) {
          					if(pr == NULL) insert_to_head(x);
          					else insert(x, pr);
          					break;
          				}
          				pr = temp;
          			}
          			if(temp == NULL) insert_to_tail(x);
          		}
          	}
          	for(List *temp = head; temp != NULL; temp = temp -> ne) {
          		printf("%d\n", temp -> num);
          	}
          	return 0;
          }
          
          • 1

          信息

          ID
          83
          时间
          1000ms
          内存
          128MiB
          难度
          4
          标签
          递交数
          605
          已通过
          302
          上传者