Nyoj 41-Three numbers from small to large (STL-to-sort (a, a+n) ascending)

Source: Internet
Author: User

41-three numbers from small to large sort


Memory limit: 64MB time limit: 3000ms special Judge:no
accepted:31 submit:44

Title Description:

Now to write a program that implements a three-digit sort of function

Input Description:
Enter a three positive integer
Output Description:
Sort three positive integers for input
Sample input:Copy
20 7 33
Sample output:
7 20 33

Analysis:
Sort directly using the sort function in the STL library

C + + code implementation (AC):
  
#include <iostream>#include<algorithm>#include<cstring>#include<cstdio>#include<cmath>#include<stack>#include<map>#include<queue>#include<Set>using namespacestd;intMain () {intt[3]; scanf ("%d%d%d", &t[0], &t[1], &t[2]); Sort (T, T+3);  for(inti =0; I <2; ++i) printf ("%d", T[i]); printf ("%d\n", t[2]); return 0;}

Nyoj 41-Three numbers from small to large (STL-to-sort (a, a+n) ascending)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.