IV-th PROGRAMMING CONTEST OF “Minko Balkanski” - May 6, 2006

TASK A.

DIVISORS

Three different integers A, B and C are given (1 < A < B < C < 2000).Write a program div to find the number of integers between 1 and N (1 < N < 1 000 000 000) that are not divisible by any of the numbers A, B and C.

The program has to read the numbers A, B, C and N, separated by intervals, from the single line of the standard input (the keyboard).

The result has to be printed on the standard oupit (the screen).

EXAMPLE

Input Output
2 3 4 10 3




TASK B.

SUMS

A sequence of N positive integers (10 < N < 100 000), each is less than or equal 10000, and a positive integer S (S <= 100 000 000) are given. Write a program sum to find the minimal length of the subsequence of consecutive elements of the sequence, the sum of wich is greater than or equal to S.

The program has to read the numbers N and S, separated by an interval, from the first line of the standard input. The element of the sequence will be given in the second line of the standard input, separated by intervals.

The result has to be printed on the standard output.

EXAMPLE

Input Output
10152
115 1 3 5 10 7 4 9 2 8



Изтегли файла (.doc)

Добави коментар

Трябва да сте регистриран потребител, за да коментирате материалите.

Коментари

Няма добавени коментари.