| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
划水老头// poj3781.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int p;
int set;
int max[3];
int value[10];
cin >> p;
while (p--)
{
cin >> set;
for (int i = 0; i < 10; i++)
cin >> value[i];
for (int i = 0; i < 3; i++)
max[i] = -1;
for (int i = 0; i < 10; i++)
if (value[i] > max[0])
{
max[2] = max[1];
max[1] = max[0];
max[0] = value[i];
}
else if (value[i] > max[1])
{
max[2] = max[1];
max[1] = value[i];
}
else if (value[i] > max[2])
{
max[2] = value[i];
}
cout << set << ' ' << max[2] << endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator