5 条题解

  • 0
    @ 2022-3-27 20:51:40
    #include <iostream>
    #include <stdio.h>
    #include <string.h>
    using namespace std;
    #define LL long long
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    int a[N];
    int main()
    {
    	int	n = 20;
    	for(int i = 0;i < 20;i++)
    		cin >> a[i];
    	for(int i = 0;i < n-1;i++)
    	{
    		for(int j = 0;j < n-i-1;j++)
    		{
    			if(a[j] > a[j+1])
    			{
    				int t = a[j];
    				a[j] = a[j + 1];
    				a[j+1] = t;
    			}
    		}
    	}
    	for(int i = 0 ; i < n ; i+=2)
    	cout << a[i] <<" ";
    }

    信息

    ID
    1007
    时间
    1000ms
    内存
    64MiB
    难度
    5
    标签
    递交数
    404
    已通过
    170
    上传者