Skip to main content

URI Online Judge problem 1042 solved

URI Online Judge | 1042

Simple Sort

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Read three integers and sort them in ascending order. After, print these values in ascending order, a blank line and then the values in the sequence as they were readed.

Input

The input contains three integer numbers.

Output

Present the output as requested above.
Input SampleOutput Sample
7 21 -14-14
7
21

7
21
-14
-14 21 7-14
7
21

-14
21
7                    
#include<stdio.h>
int main(void){
    int a,b,c;
    while(scanf("%d%d%d",&a,&b,&c)==3){
        if(a>=b && a>=c && b>=c)
            printf("%d\n%d\n%d\n\n%d\n%d\n%d\n",c,b,a,a,b,c);
        else if(a>=b && a>=c && c>=b)
            printf("%d\n%d\n%d\n\n%d\n%d\n%d\n",b,c,a,a,b,c);
        else if(b>=c && b>=a && c>=a)
            printf("%d\n%d\n%d\n\n%d\n%d\n%d\n",a,c,b,a,b,c);
        else if(b>=c && b>=a && a>=c)
            printf("%d\n%d\n%d\n\n%d\n%d\n%d\n",c,a,b,a,b,c);
        else if(c>=a && c>=b && a>=b)
            printf("%d\n%d\n%d\n\n%d\n%d\n%d\n",b,a,c,a,b,c);
        else if(c>=a && c>=b && b>=a)
            printf("%d\n%d\n%d\n\n%d\n%d\n%d\n",a,b,c,a,b,c);
    }
    return 0;
}







Comments

Popular posts from this blog

**Competitive Programming এর জন্য কি কি শিখতে হবে...**

link: https://github.com/me-shaon/bangla-programming-resources -------------------------------------------------------------------------------------------------------------------------- এলগোরিদম ব্যাসিক বিগ "O" নোটেশন  -  শাফায়েত আশরাফ কমপ্লেক্সিটি ক্লাস(P-NP, টুরিং মেশিন ইত্যাদি)  -  শাফায়েত আশরাফ ডাটা স্ট্রাকচার অ্যাারে (Array) অ্যারে ব্যাসিক অপারেশন  -  হাসান আবদুল্লাহ অ্যারে কমপ্রেশন/ম্যাপিং  -  শাফায়েত আশরাফ লিংকড লিস্ট (Linked List) লিংকড লিস্ট  -  শাফায়েত আশরাফ লিংকড লিস্ট ব্যাসিক অপারেশন  -  হাসান আবদুল্লাহ লিংকড লিস্ট  -  অনিন্দ্য পাল লিংকড লিস্ট – সি  -  মুনতাসির ওয়াহেদ ডাটা স্ট্রাকচার ও লিংকড লিস্ট  -  আলাভোলা কোডিং লিংকড লিস্ট  -  আলাভোলা ডাবলি লিংকড লিস্ট  -  মুনতাসির ওয়াহেদ স্ট্যাক (Stack) স্ট্যাক  -  শাফায়েত আশরাফ স্ট্যাক ব্যাসিক অপারেশন  -  হাসান আবদুল্লাহ স্ট্যাক বেসিক ডাটা স্ট্রাকচার  -  আহম...

codeforce problemset 758A solved

A. Holiday Of Equality time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are  n  citizens, the welfare of each of them is estimated as the integer in  a i  burles (burle is the currency in Berland). You are the royal treasurer, which needs to count the minimum charges of the kingdom on the king's present. The king can only give money, he hasn't a power to take away them. Input The first line contains the integer  n  ( 1 ≤  n  ≤ 100 ) — the number of citizens in the kingdom. The second line contains  n  integers  a 1 ,  a 2 , ...,  a n , where  a i  ( 0 ≤  a i  ≤ 10 6 ) — the welfare of the  i -th citizen. Output In the only li...

700 problems to understand you complete algorithmic programming.

700 problems to understand you complete algorithmic programming. 1. Segment Tree: To Read : http://www.topcoder.com/tc?d1=tutorials&d2=lowestCommonAncestor&module=Static http://ronzii.wordpress.com/2011/07/08/segment-tree-tutorial/ http://se7so.blogspot.in/2012/12/segment-trees-and-lazy-propagation.html http://olympiad.cs.uct.ac.za/presentations/camp3_2007/interval_trees.pdf http://codeforces.com/blog/entry/6281 http://apps.topcoder.com/forums/?module=Thread&threadID=651820&start=0&mc=2#1146133 http://www.algorithmist.com/index.php/Segmented_Trees http://letuskode.blogspot.in/2013/01/segtrees.html http://wcipeg.com/wiki/Heavy-light_decomposition http://discuss.codechef.com/questions/5960/rnestescape-from-the-mines http://ideone.com/dPS5N  (Heavy Light implementation). https://sites.google.com/site/indy256/algo/heavy_light  (Heavy Light implementation). Problems: http://www.spoj.com/problems/GSS1 http://www.spoj.com/problems/GSS2 http://www.spoj.com...