here is problem link :

https://www.spoj.pl/problems/EMP/

Results 1 to 5 of 5

- Sep 3rd 2010, 05:48 PM #1

- Joined
- Jun 2010
- From
- Zewail University - Cairo - Egypt
- Posts
- 142

## i want help in problem

here is problem link :

https://www.spoj.pl/problems/EMP/

- Sep 3rd 2010, 05:53 PM #2

- Joined
- Aug 2010
- Posts
- 16

- Sep 3rd 2010, 05:54 PM #3

- Joined
- Jun 2010
- From
- Zewail University - Cairo - Egypt
- Posts
- 142

- Sep 3rd 2010, 07:18 PM #4

- Joined
- Apr 2005
- Posts
- 18,591
- Thanks
- 2598

First, if this problem is really of interest to you, it would have looked better, and perhaps encouraged more people to respond, if you had taken the trouble to type the problem in rather than just copying it to a file and requiring others to open the file. That's always a nuisance and always has the possiblity of opening a virus.

You are told that, on a certain island, everyone either always tells the truth or always lies. Also you are told that if you ask people at the university on this island, they will always tell you the following two things, no matter which employee you ask:

1. There are fewer than N employees who work more than me.

2. At least M employees of the university have a larger salary than me

You are asked to write a computer program that given the two values, N and M, will return the number of employees at the University.

They they give the example of N and M both equaling 1 in which case, we are told, the program should return "2".

That is, any employee at the University must respond either:

1. There is less than 1 employee who works more than me. (I.e. there are NO employees who work more than me.)

2. At least 1 employee of the university has a larger salary than me

But remember that some employees always tell the truth and some always lie.

So you would have to consider a number of possiblities. It is possible that all those who tell the truth will answer (1) and all those who lie will answer (2). Or the other way around. But you should also consider the possibility that some people who tell always tell the truth could answer (1) and some who always lie could answer (1). What would that mean?

- Sep 3rd 2010, 08:06 PM #5

- Joined
- Jun 2010
- From
- Zewail University - Cairo - Egypt
- Posts
- 142