This repository has been archived by the owner on Apr 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0037.html
51 lines (50 loc) · 8.63 KB
/
0037.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<div><span style="font-family: 'Courier New'; ">ในวันปีใหม่ สนามกีฬาแห่งหนึ่งได้ประดับไฟที่พื้นสนามฟุตบอลเพื่อความสวยงาม ในการประดับไฟนั้นทำโดยแบ่งสนามสี่เหลี่ยมเป็นช่องย่อยๆ จำนวน N แถว แถวละ M คอลัมน์ รวม N<span style="color: rgb(102, 102, 102); font-size: 13px; ">×</span>M ช่อง เจ้าของสนามได้เปิดสนามให้ประชาชนทั่วไปเข้าชมเพื่อความสวยงาม<br />
</span><span style="font-family: 'Courier New'; "><br />
อย่างไรก็ตาม โลกนี้ไม่มีอะไรฟรี เจ้าของสนามจะต้องจ่ายค่าไฟให้กับไฟประดับเหล่านี้ เนื่องจากมีการประดับไฟเป็นลวดลายต่างๆ ค่าไฟของไฟแต่ละช่องไม่จำเป็นต้องเท่ากัน<br />
</span><span style="font-family: 'Courier New'; "><br />
เพื่อไม่ให้เป็นการขาดทุน เจ้าของสนามจึงได้จัดเครื่องไอพ่นเจ็ตส่วนบุคคลให้กับประชาชนเช่าเพื่อบินดูไฟประดับ เครื่องพ่นเจ็ตแต่ละเครื่องเมื่อเช่าไปแล้วจะผู้ใช้จะสามารถบินได้ทั้งสิ้น K ครั้ง ในการบินแต่ละครั้งจะใช้เชื้อเพลิงมูลค่าเท่ากับ L บาท </span><span style="font-family: 'Courier New'; ">ดังนั้น ค่าใช้จ่ายรวมทั้งหมดของเจ้าของสนามคือค่าไฟรวมของไฟประดับ และค่าเชื้อเพลิงรวมของการบินเครื่องไอพ่นเจ็ตในการบินทั้งหมด<br />
</span><span style="font-family: 'Courier New'; "><br />
เจ้าของสนามทราบว่าจะมีคนมาชมและเช่าเครื่องไอพ่นเจ็ตจำนวน C คน เขาต้องการคำนวณค่าเช่าเครื่องไอพ่นเจ็ตต่อคนที่น้อยที่สุด ที่จะทำให้เขาไม่ขาดทุน เพื่อให้การเช่าเป็นไปได้สะดวก ค่าเช่าจะต้องเป็นจำนวนเต็มเสมอด้วย<br />
</span><span style="font-family: 'Courier New'; "><br />
</span><u><strong><span style="font-family: 'Courier New'; ">งานของคุณ</span></strong></u></div>
<div><span style="font-family: 'Courier New'; ">เขียนโปรแกรมรับราคาค่าไฟของสนามแต่ละช่อง รวมทั้งข้อมูลของการใช้เครื่องไอพ่นเจ็ต จากนั้นคำนวณหาค่าเช่าเครื่องไอพ่นเจ็ตต่อคนที่เป็นจำนวนเต็มที่น้อยที่สุด </span><span style="font-family: 'Courier New'; ">ที่จะทำให้เจ้าของสนามไม่ขาดทุน<br />
</span><span style="font-family: 'Courier New'; "><br />
</span><u><strong><span style="font-family: 'Courier New'; ">ข้อมูลนำเข้า</span></strong></u></div>
<div><span style="font-family: 'Courier New'; ">บรรทัดแรกระบุจำนวนเต็มบวก N และ M คั่นด้วยช่องว่าง แทนขนาดความกว้างและความยาวของสนาม (1 </span><span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤ </span><span style="font-family: 'Courier New'; ">N </span><span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤ </span><span style="font-family: 'Courier New'; ">100; 1 </span><span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤ </span><span style="font-family: 'Courier New'; ">M </span><span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤ </span><span style="font-family: 'Courier New'; ">100)</span></div>
<div><span style="font-family: 'Courier New'; "><br />
บรรทัดที่สองระบุจำนวนเต็มบวก L และ K คั่นด้วยช่องว่าง โดยที่ L แทนราคาเชื้อเพลิงต่อการบินหนึ่งครั้งและ K แทนจำนวนครั้งที่เครื่องไอพ่นใช้บินได้ต่อคนเช่าหนึ่งคน (1 </span><span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤ </span><span style="font-family: 'Courier New'; ">L </span><span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤ </span><span style="font-family: 'Courier New'; ">100; 1 </span><span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤ </span><span style="font-family: 'Courier New'; ">K </span><span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤ </span><span style="font-family: 'Courier New'; ">100)</span></div>
<div><span style="font-family: 'Courier New'; "><br />
บรรทัดที่สามระบุจำนวนเต็มบวก C แทนจำนวนผู้เล่นทั้งหมดที่เข้ามาเล่น (1 </span><span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤ </span><span style="font-family: 'Courier New'; ">C < 1,000)</span></div>
<div><span style="font-family: 'Courier New'; "><br />
บรรทัดถัดไปอีก N บรรทัด แต่ละบรรทัดรับจำนวนเต็มบวก M ตัว แต่ละตัวถูกคั่นด้วยช่องว่าง แทนค่าไฟในแต่ละช่องที่ประดับไฟ ซึ่งจะเป็นจำนวนเต็มบวกที่มีค่าไม่เกิน 3,000<br />
</span><span style="font-family: 'Courier New'; "><br />
<u><strong>ข้อมูลส่งออก</strong></u><br />
</span><span style="font-family: 'Courier New'; ">มีบรรทัดเดียวเป็นจำนวนเต็มบวกหนึ่งจำนวน แทน</span><span style="font-family: 'Courier New'; ">ค่าเช่าเครื่องไอพ่นเจ็ตต่อคนที่เป็นจำนวนเต็มที่น้อยที่สุด </span> <span style="font-family: 'Courier New'; ">ที่จะทำให้เจ้าของสนามไม่ขาดทุน<br />
<br />
</span><u style="font-family: 'Courier New'; "><strong>ที่มา</strong></u><br style="font-family: 'Courier New'; " />
<span style="font-family: 'Courier New'; ">การแข่งขัน IOI Thailand League เดือนกันยายน 2553</span><br style="font-family: 'Courier New'; " />
<span style="font-family: 'Courier New'; ">โจทย์โดย: </span><font face="'Courier New'">ธงชัย วิโรจน์ศักดิ์เสรี</font><span style="font-family: 'Courier New'; "><br type="_moz" />
</span></div>
<table>
<tr>
<th>ข้อมูลนำเข้า</th>
<th>ข้อมูลส่งออก</th>
</tr>
<tr>
<td>3 3
<br />2 1
<br />1
<br />1 1 1
<br />1 1 1
<br />1 1 1</td>
<td>11</td>
</tr>
<tr>
<td>3 4
<br />3 2
<br />7
<br />1 2 3 4
<br />4 3 2 1
<br />1 1 1 1</td>
<td>10</td>
</tr></table>