11727-cost Cutting
Time limit:1.000 seconds
Http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem &problem=2827
Company XYZ have been badly hit by recession and are taking a lot of cost cutting measures. Some of measures include giving up office spaces, going open source, reducing incentives, cutting on luxuries and ISS Uing Pink slips.
They have got three (3) employees working in the accounts department and are going to lay-off two (2) of them. After a series of meetings, they have decided to dislodge the person who gets the most salary and the one who gets the Lea St. This is usually the general trend during crisis as this.
You are given the salaries of these 3 employees working in the accounts department. You are have the salary of the Who survives.
Input
The the "a" of input is a integer T (t<20) that indicates the number of test cases. Each case consists of the a line with 3 distinct positive integers. These 3 integers represent the salaries of the three employees. All of these integers is in the range [1000, 10000].
Output
For each case, output the case number followed by the salary of the Who survives.
Sample input Output for sample input
3
1000 2000 3000
3000 2500 1500
1500 1200 1800
Case 1:2000
Case 2:2,500
Case 3:1500
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/
Complete code:
/*0.013s*/
#include <cstdio>
#include <algorithm>
using namespace std;
int a[3];
int main ()
{
int t;
scanf ("%d", &t);
for (int i = 1; I <= t; ++i)
{
scanf ("%d%d%d", &a[0], &a[1], &a[2));
Nth_element (A, A + 1, a + 3);
printf ("Case%d:%d\n", I, a[1]);
}
return 0;
}
Author: csdn Synapse7