#P5715. 【深基3.例8】三位数排序

【深基3.例8】三位数排序

Sorting Three Integers

Problem Source

Luogu P5715

Problem Description

Given three integers a,b,ca, b, c (0≤a,b,c≤1000 \le a, b, c \le 100), sort these three integers in ascending order.

Input Format

Three integers a,b,ca, b, c, separated by spaces.

Output Format

One line containing the three integers in ascending order.

Sample Input 1

1 14 5

Sample Output 1

1 5 14

Sample Input 2

2 2 2

Sample Output 2

2 2 2

Hint

  • There are only 3 numbers, so comparing and swapping pairs will sort them: think about the minimum number of comparisons and who should come first after each comparison.
  • Swapping two variables needs a third variable as temporary storage.
  • Check against the sample: 1 14 5 → 1 5 14.