zoukankan      html  css  js  c++  java
  • 【TFLSnoi李志帅】---sort

    排序一百(本题建议使用sort)

    输入一个长度为n的数组,将他排成升序,即对于任意相邻2个数字aii,ai+1i+1来说,aii <= ai+1i+1。

    Input第一行一个整数n,表示数字长度 接下来n行,每行一个整数aii,表示数组的内容。 1≤n≤100,1≤aii≤10^9Output输出第一行为数组长度n 接下来n行为排序后的结果。Sample Input

    4
    4
    3
    1
    2

    Sample Output

    4
    1
    2
    3
    4


    ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
    代码(满分):
     1 #include <bits/stdc++.h>
     2 using namespace std;
     3 int main()
     4 {
     5     long long n,a[105];
     6     cin>>n;
     7     for(int i=0;i<n;i++)cin>>a[i];
     8     sort(a,a+n);
     9     cout<<n<<endl;
    10     for(int i=0;i<n;i++)cout<<a[i]<<endl;
    11     return 0;
    12 }

    sort用法相关链接:https://www.cnblogs.com/junbaobei/p/10776066.html

  • 相关阅读:
    Java+seleinum+testng框架UI自动化测试环境搭建--第一节
    linux常用命令
    Linux下定时任务的查看及取消
    WampServer环境安装
    Airtest断言方法
    Pycharm创建模板头部默认
    QPS/TPS简介
    简易全文搜索引擎设计
    如何在linux下检测内存泄漏
    箱线图(boxplot)简介与举例
  • 原文地址:https://www.cnblogs.com/TFLSc1908lzs/p/13544583.html
Copyright © 2011-2022 走看看