zoukankan      html  css  js  c++  java
  • GDUFE ACM-1125

    题目:http://acm.gdufe.edu.cn/Problem/read/id/1125

    国庆作业系列——B.三个数比较

    Time Limit: 2000/1000ms (Java/Others)

    Problem Description:

     输入三个不同的整数,让它们按从小到大的顺序排列输出。
       例:输入  3  2  5
           输出  2  3  5
    

    Input:

    输入包含若干个输入实例,数据保证三个整数互不相同

    Output:

    输出结果,格式看例子

    Sample Input:

    5 2 3
    9 1 3

    Sample Output:

    2 3 5
    1 3 9

    思路:就比较一下,有很多种方法,我就写了一种,《算法竞赛入门经典》上有例题

    难度:很简单

    代码:
     1 #include<stdio.h>
     2 int main()
     3 {
     4     int a,b,c,d;
     5     while(scanf("%d%d%d",&a,&b,&c)!=EOF)
     6     {
     7         if(a>b)
     8         {
     9             d=a;a=b;b=d;
    10         }
    11         if(a>c)
    12         {
    13             d=a;a=c;c=d;
    14         }
    15         if(b>c)
    16         {
    17             d=b;b=c;c=d;
    18         }
    19         printf("%d %d %d
    ",a,b,c);
    20     }
    21     return 0;
    22 }
  • 相关阅读:
    python 爬虫 urllib模块 url编码处理
    python 爬虫 urllib模块 目录
    python 爬虫 urllib模块介绍
    python 爬虫 目录
    爬虫 介绍
    POJ 2533
    POJ 2531
    POJ 2524
    POJ 2505
    POJ 2521
  • 原文地址:https://www.cnblogs.com/ruo786828164/p/5971170.html
Copyright © 2011-2022 走看看