CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

1. ## Eligibility Rules

The program committee must be able to correctly estimate the level of teams that will participate in the forthcoming contest and choose the problems according to that level. It is not always easy to prepare a problem set that will please both school teams and the most experienced veterans of the programming contests, who won dozens of them.
In order to make his job easier, the chairman of the program committee asked the chairman of the jury to make the eligibility rules stricter and forbid too young or too experienced teams to participate in the contest.
For each team that had applied for participation, the jury calculated the average age of its members and the number of official contests this team participated in. In addition, the program committee estimated the satisfaction that each team would get from the problem set.
The jury decided to state the eligibility rules as follows: a team is eligible to participate if and only if its average age and the number of contests it participated in fall in certain ranges of values. It only remained to set the boundaries of these ranges so that the sum of satisfactions of the eligible teams would be as large as possible. Of course, there had to be at least two eligible teams, otherwise there would have been no sense in holding the contest.

Input
The first line contains the number n of teams that want to participate in the contest (2 ≤ n ≤ 1500). Each of the following n lines contains three space-separated integers a, f and s (4·108 ≤ a ≤ 109; 0 ≤ f, |s| ≤ 109). They are the average age of participants (in seconds), the number of official contests the team participated in, and the satisfaction that the team will get from the problem set, respectively.
Output
In the first line output the minimal and maximal admissible average age of participants. In the second line output the minimal and maximal admissible number of contests. All these numbers must be nonnegative integers and must not exceed 109. If there are several possible answers, output any of them.

Sample

input
4
500000000 1 1
510000000 3 -10
600000000 3 2
700000000 4 3

output
550000000 750000000
2 5

That's source http://acm.timus.ru/problem.aspx?spa...1717&locale=en

My beginning code
Code:
```import java.io.*;

public class elig {

/**
* @param args
*/
public static void main(String[] args)throws IOException {
// TODO Auto-generated method stub

int n = 0, a = 0, f = 0, s = 0;

do
{
System.out.print(">> Введите n (2 <= n <= 1500): ");

}
while ((n<2) || (n>1500));
for (int i=0; i<n;i++)
{

do
{
System.out.print(">> Введите a (4·10^8 <= a <= 10^9): ");

}
while ((a<4*Math.pow(10, 8)) || (a>Math.pow(10, 9)));

do
{
System.out.print(">> Введите f (f >= 0): ");

}
while (f<0);

do
{
System.out.print(">> Введите s (|s| <= 10^9): ");

}
while (Math.abs(s)>Math.pow(10, 9));
}
}

}```
I don't undestand what we must to do. And I don't know how we receive output. Help me to solve this problem, please.

2. Elite Member Power Poster
Join Date
May 2006
Location
UK
Posts
4,473

## Re: Eligibility Rules

Before writing any code get a pen and paper and pretending you are the computer write down every step/action you (the computer) take to solve this problem. Write this in your native language and only when you have a satisfactory set of instructions to complete the whole task attempt to change this into code.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•