1 条题解
-
0
C :
#include<stdio.h> int main() { int a,b,c,t; scanf("%d%d%d",&a,&b,&c); if(a<b) { t=a,a=b,b=t; } if(a<c) { t=a,a=c,c=t; } if(b<c) { t=b,b=c,c=t; } printf("%d %d %d",a,b,c); return 0; }C++ :
#include<stdio.h> int main() { int a,b,c,d; scanf("%d %d %d",&a,&b,&c); if(a<b) { d=a; a=b; b=d; } if(a<c) { d=a; a=c; c=d; } if(b<c) { d=b; b=c; c=d; } printf("%d %d %d",a,b,c); return 0; }Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] a = new int[3]; a[0] = sc.nextInt(); a[1] = sc.nextInt(); a[2] = sc.nextInt(); java.util.Arrays.sort(a); for (int i = 2; i >=0; i--){ System.out.print(a[i] + " "); } } }Python :
# coding=utf-8 #!/usr/bin/python2 import sys import re import math a,b,c=(int(x) for x in raw_input().split(' ')) temp=0 if a<b: temp=a a=b b=temp if a<c: temp=a a=c c=temp if b<c: temp=b b=c c=temp print a,b,cC# :
using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace ConsoleApp2 { internal class Program { static void Main() { //int[] days = { 31,28,31,30,31,30,31,31,30,31,30,31}; /*int n = Convert.ToInt32 (Console.ReadLine()); string[] a1 = Console.ReadLine().Split(); double r = Convert.ToDouble(a1[0]); double b = Convert.ToDouble(a1[1]); double c = Convert.ToDouble(a1[2]); float pi = 3.1415926f; string S = ((r + b+c) / n).ToString("0.00"); */ string[] n = Console.ReadLine().Split(' '); int a = Convert.ToInt16(n[0]); int b = Convert.ToInt16(n[1]); int c = Convert.ToInt16(n[2]); int max =0; int e = 0; int d = 0; if (a >= b && a >= c) { max=a; d = b; e = c; } else if (b >= a && b >= c) { max = b; d = c; e = a; } else { max = c; d = a; e = b; } string T = "o"; string ma = Convert.ToString(max)+" "; string m = Convert.ToString(d)+" "; string s = Convert.ToString(e) + " "; if (d >e) { Console.WriteLine(ma+m+s); } else { Console.WriteLine(ma+s+m); } Console.ReadKey(); } } }
- 1
信息
- ID
- 27
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 2
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者