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
/
0034.html
29 lines (28 loc) · 4.7 KB
/
0034.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
<div><span style="font-family: 'Courier New'; ">ว่ากันว่าชีวิตช่วงมัธยมต้นเป็นชีวิตที่สดใส มีแต่ความสุข แต่นั่นไม่เป็นจริงสำหรับคุณ ไม่ใช่เพราะว่าคุณกำลังมีเรื่องกลุ้มใจ แต่เป็นเพราะการบ้านวิชาคณิตศาสตร์ เรื่อง สมการกำลังสอง (Quadratic Equation) ที่กองเป็นภูเขาของคุณ คุณอยากจะไปเล่นกับเพื่อนๆมาก แต่คุณก็ต้องมานั่งปั่นการบ้านที่จะต้องส่งในวันพรุ่งนี้ คุณอยากจะทำมันให้เสร็จโดยเร็วที่สุด แต่ไม่ใช่ด้วยการลอกเพื่อน…<br />
<br />
คุณตัดสินใจที่จะเขียนโปรแกรมแก้สมการกำลังสองออกมา สมการนี้สามารถเขียนในรูปทั่วไปได้เป็น Ax<sup>2</sup> + Bx + C = 0 โดยวิธีที่จะแก้สมการนี้ได้นั้น คุณจะต้องแยกตัวประกอบของมันออกมาเป็น (ax + b)(cx + d) เมื่อ A = ac, B = ad + bc, C = bd และ a, b, c, d เป็นจำนวนเต็ม (a,c > 0) ในการบ้านของคุณมีค่า A, B, C มาให้ คุณต้องเขียนโปรแกรมเพื่อหาค่า a, b, c และ d ที่เป็นไปตามเงื่อนไขดังกล่าว<br />
<br />
<u><strong>ข้อมูลนำเข้า</strong></u><br />
จำนวนเต็ม A, B และ C คั่นด้วยช่องว่าง 1 ช่อง (1 </span> <span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤</span> <span style="font-family: 'Courier New'; "> A </span> <span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤</span> <span style="font-family: 'Courier New'; "> 100; -10000 </span><span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤</span><span style="font-family: 'Courier New'; "> B </span><span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤</span><span style="font-family: 'Courier New'; "> 10000; -100 </span><span style="color: rgb(102, 102, 102); font-family: 'Courier New'; font-size: 13px; ">≤</span><span style="font-family: 'Courier New'; "> C </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 />
<u><strong>ข้อมูลส่งออก</strong></u><br />
มีเพียงบรรทัดเดียว แสดงจำนวนเต็ม a, b, c และ d ที่เป็นไปตามเงื่อนไขคั่นด้วยช่องว่าง 1 ช่อง<br />
<br />
หากมีคำตอบที่เป็นไปได้หลายชุด ให้ตอบคำตอบที่มีค่า a น้อยที่สุด หากมีคำตอบที่มีค่า a น้อยที่สุดเท่ากันหลายชุด ให้ตอบคำตอบที่มีค่า b น้อยที่สุดในบรรดาคำตอบเหล่านั้น และหากไม่มีคำตอบที่เป็นไปได้เลย ให้พิมพ์คำว่า No Solution<br />
<br />
<u style="font-family: 'Courier New'; "><strong>ที่มา</strong></u><br style="font-family: 'Courier New'; " />
การแข่งขัน IOI Thailand League เดือนตุลาคม 2553<br style="font-family: 'Courier New'; " />
โจทย์โดย: จิรายุ ลือเวศย์วณิช</span></div>
<table>
<tr>
<th>ข้อมูลนำเข้า</th>
<th>ข้อมูลส่งออก</th>
</tr>
<tr>
<td>4 5 1</td>
<td>1 1 4 1</td>
</tr>
<tr>
<td>1 1 1</td>
<td>No Solution</td>
</tr></table>