洛谷-P5715 【深基3.例8】三位数排序

洛谷-P5715 【深基3.例8】三位数排序

原题链接:https://www.luogu.com.cn/problem/P5715


题目描述

给出三个整数 \(a,b,c(0\le a,b,c \le 100)\),要求把这三位整数从小到大排序。

输入格式

输出格式

输入输出样例

输入 #1

1 14 5

输出 #1

1 5 14

输入 #2

2 2 2

输出 #2

2 2 2

C++代码

#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    int n[3];
    cin >> n[0] >> n[1] >> n[2];
    sort(n, n+3);
    cout << n[0] << ' ' << n[1] << ' ' << n[2] <<endl;
    return 0;
}
posted @ 2020-07-17 11:25  yuzec  阅读(710)  评论(0编辑  收藏  举报