Annulleret

2 programs (1 in C or C++ & 1 in SML/NJ or MLton or OCaml) vol. 2 [deadline 15/6/2014]

Ready for the new avenues of development?

Due to the recent economical crisis most of the roads in the countryside are in a complete [url removed, login to view] roads are damaged and in need of reconstruction.A new political party did well in the elections so in order to reward their sponsors they assigned them the reconstruction of the [url removed, login to view] the reconstruction is being done [url removed, login to view] day a group starts to reconstruct a CONTINUOUS part of the road, which is known where it starts and [url removed, login to view] one other next day it is possible to reconstruct again some part of the road that has already fully or partially been reconstructed! Every road has length L kilometers and needs to be reconstructed in all of its length. The group has scheduled to work N days and the k-th day has scheduled to reconstruct the part of the road that starts from S(k) and ends to E(k). The party,that assigned the task, wants to know after how many days the biggest part of the road that hasn't been reconstructed yet will not be bigger than X meters.

-->The exercise wants you to write 2 programs (one in C or C++ AND one in SML/NJ or MLton or OCaml) that take as input the information about the reconstruction and that number X and returns as output the minimum number of days that the group needs to work so that the biggest not-yet-reconstructed part of the road is not bigger than X. If this isn't ever going to happen ,based on the schedule of the group, your programs must return [url removed, login to view] input is read from a file as shown in the examples [url removed, login to view] first line of the file has 3 numbers: N (1<= N<= [url removed, login to view]), L (1<= L<= [url removed, login to view]) and X (0<= X <=L ) separated with [url removed, login to view] N lines follow each of them has 2 integers S(k) and E(k) (0<= S(k) < E(k) <= L ) separated with a space.

Constraints: Time: 10seconds Memory: 256MB

Above there are some examples in both C and ML:

In C,C++,MLton,OCaml:

> ./dromoi [url removed, login to view]

2

> ./dromoi [url removed, login to view]

-1

In SML/NJ:

- dromoi "[url removed, login to view]";

val it = 2 : int

- dromoi "[url removed, login to view]";

val it = ~1 : int

where the input files are

> cat [url removed, login to view]

4 30 6

1 5

11 27

2 14

18 28

> cat [url removed, login to view]

4 30 1

1 5

11 27

2 14

18 28

In both examples above the length of the road and the schedule of the group are the same and only X is [url removed, login to view] the 1st day the biggest continuous part of the road that hasn't been reconstructed yet has length 25(from 5 to 30).After the 2nd day its length is 6(from 5 to 11).After the 3rd day is 3(from 27 to 30) and after the 4th day it's 2(from 28 to 30).So the correct answer for the first example is 2(after the 2nd day the length won't be bigger than X=6).For the second example the correct answer is -1(the length of the road will never be equal to X=1 or smaller)

Færdigheder: Algoritme, C programmering, C++ Programmering

Se mere: sml programming, road programming, programming programs, ml programming, work integers, exercise programming, every days, read example, programming input output, cplusplus programming examples, write task, vol, val , th write, reconstruction, ocaml, nj, need follow deadline, elections, continuous line, follow deadline, input output schedule, write programs, ready programs, programming read lines file

Om arbejdsgiveren:
( 3 bedømmelser ) Athens, Greece

Projekt-ID: #6044558

4 freelancere byder i gennemsnit $40 for dette job

super2lao

A proposal has not yet been provided

$74 USD på 1 dag
(17 bedømmelser)
4.8
infomanoj

A proposal has not yet been provided

$25 USD in 4 dage
(0 bedømmelser)
0.0
sunethsl

Hello, I am a final year computer engineering student and I have a good knowledge about C/C++ languages and I have followed a course on OCaml. Therefore I can do this work without any difficulty. Please give this w Mere

$35 USD in 2 dage
(0 bedømmelser)
0.0
yogsram12

As I'm having good programming skills in C and know OCaml.I was learning C language more than 7 years am able to understand the requirements of the project and also which makes me to give a complete project with your Mere

$25 USD på 1 dag
(0 bedømmelser)
0.0