Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

RGB1132 - Хашааны засвар

Нэгэн хүчтэй салхины улмаас Жоны хувийн хашаа нурчихжээ. Зөвхөн шонгууд нь л үлдсэн байна. С ширхэг шон байгаа ба шонгууд нь тоон шулуун дээр натурал тоогоор дүрслэгдэнэ. Жон уг шонгуудаа банзаар холбон М хэсэг болгохыг хүсэв. Тэгэхдээ хэсэг хашааны уртуудын нийлбэр хамгийн бага байлгахыг хүсч танаас тусламж гуйж байна. Түүнд тусална уу?

 Оролт

Эхний мөрөнд M(1 <= M <= 50), S(1 <= S <= 200), C(1 <= C <= S) тоонууд зайгаар тусгаарлагдан өгөгдөнө.

Дараагийн C мөрөнд шонгуудын байгаа утга Y[i](1<=Y[i]<=200) өгөгдөнө.

Гаралт

Хэсэг хашааны уртуудын нийлбэр хамгийн бага утга.

Жишээ

Оролт :

4 50 18

3

4

6

8

14

15

16

17

21

25

26

27

30

31

40

41

42

43

Гаралт :

25

Үндсэн тестийн хувьд 3-8, 14-21, 25-31, 40-43 гэж хийсэн.

Орчуулсан : У.Наранбаяр


Нэмсэн:Bataa
Огноо:2010-02-18
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:ADA95 ASM32 ASM64 BASH BF C CSHARP C++ 4.3.2 CPP CPP14 C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCALA SCM guile SCM qobi ST TCL TEXT WHITESPACE

hide comments
2025-04-12 05:48:35
It was a dark and stormy night that ripped the roof and gates off the stalls that hold Farmer John’s cows. Happily, many of the cows were on vacation, so the barn was not completely full.

The cows spend the night in stalls that are arranged adjacent to each other in a long line. Some stalls have cows in them; some do not. All stalls are the same width.

Farmer John must quickly erect new boards in front of the stalls, since the doors were lost. His new lumber supplier will supply him boards of any length he wishes, but the supplier can only deliver a small number of total boards. Farmer John wishes to minimize the total length of the boards he must purchase.

Given M (1 <= M <= 50), the maximum number of boards that can be purchased; S (1 <= S <= 200), the total number of stalls; C (1 <= C <= S) the number of cows in the stalls, and the C occupied stall numbers (1 <= stall_number <= S), calculate the minimum number of stalls that must be blocked in order to block all the stalls that have cows in them.

Print your answer as the total number of stalls blocked.
2011-05-21 04:32:43 Buiandelger
Output
6
2011-05-21 04:32:30 Buiandelger
Input:
50 30 6
30
25
20
15
10
5
2011-05-21 04:31:27 Buiandelger
Mchin bas yg M shirheg bish M ni max l ym bna shde
2011-05-18 03:42:27 Buiandelger
eguulbertee buh shong orolcuulan gej nemvel ysan ym be
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.