Team Ai
Datasetpublic

prithivMLmods/Coder-Stat

Coder-Stat Dataset Overview The Coder-Stat dataset is a collection of programming-related data, including problem IDs, programming languages, original statuses, and source code snippets. This dataset is designed to assist in the analysis of coding patterns, error types, and performance metrics. Dataset Details Modalities Tabular: The dataset is structured in a tabular format. Text: Contains text data, including source code snippets.… See the full description on the dataset page: https://huggingface.co/datasets/prithivMLmods/Coder-Stat.

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
3likes139downloads
p00863.html129 linesDownload Raw Back to problem_descriptions
1 2<H1><font color="#000">Problem J:</font> The Teacher’s Side of Math</H1>3 4<p>5One of the tasks students routinely carry out in their mathematics classes is to solve a polynomial equation. It is, given a polynomial, say <i>X</i><sup>2</sup> - 4<i>X</i> + 1, to find its roots (2 &plusmn; &radic;3).6</p>7 8<p>9If the students’ task is to find the roots of a given polynomial, the teacher’s task is then to find a polynomial that has a given root. Ms. Galsone is an enthusiastic mathematics teacher who is bored with finding solutions of quadratic equations that are as simple as <i>a</i> + <i>b</i>&radic;<i>c</i>. She wanted to make higher-degree equations whose solutions are a little more complicated. As usual in problems in mathematics classes, she wants to maintain all coefficients to be integers and keep the degree of the polynomial as small as possible (provided it has the specified root). Please help her by writing a program that carries out the task of the teacher’s side.10</p>11 12<p>13You are given a number t of the form:14</p>15 16<center>17<p>18    t = <sup><i>m</i></sup>&radic;<i>a</i>+<sup><i>n</i></sup>&radic;<i>b</i>19</p>20</center>21 22<p>23where <i>a</i> and <i>b</i> are distinct prime numbers, and <i>m</i> and <i>n</i> are integers greater than 1.24</p>25 26<p>27In this problem, you are asked to find t's <i>minimal polynomial on integers</i>, which is the polynomial <i>F</i>(<i>X</i>) = <i>a<sub>d</sub>X<sup>d</sup></i> + <i>a</i><sub><i>d</i>-1</sub><i>X</i><sup><i>d</i>-1</sup> + ... + <i>a</i><sub>1</sub><i>X</i> + <i>a</i><sub>0</sub> satisfying the following conditions.28</p>29 30<ol>31   <li> Coefficients <i>a</i><sub>0</sub>, ... , <i>a<sub>d</sub></i> are integers and <i>a<sub>d</sub></i> &gt; 0.</li>32   <li> <i>F</i>(<i>t</i>) = 0.</li>33   <li> The degree <i>d</i> is minimum among polynomials satisfying the above two conditions.</li>34   <li> <i>F</i>(<i>X</i>) is primitive. That is, coefficients <i>a</i><sub>0</sub>, ... , <i>a<sub>d</sub></i> have no common divisors greater than one.</li>35</ol>36 37<p>38For example, the minimal polynomial of &radic;3+ &radic;2 on integers is <i>F</i>(<i>X</i>) = <i>X</i><sup>4</sup> - 10<i>X</i><sup>2</sup> + 1. Verifying <i>F</i>(<i>t</i>) = 0 is as simple as the following (<i>&alpha;</i> = 3, <i>&beta;</i> = 2).39</p>40 41<p>42<i>F</i>(<i>t</i>) = (<i>&alpha;</i> + <i>&beta;</i>)<sup>4</sup> - 10(<i>&alpha;</i> + <i>&beta;</i>)<sup>2</sup> + 143</p>44 45<p>46= (<i>&alpha;</i><sup>4</sup> + 4<i>&alpha</i><sup>3</sup><i>&beta;</i> + 6<i>&alpha;</i><sup>2</sup><i>&beta;</i><sup>2</sup> + 4<i>&alpha;&beta;</i><sup>3</sup> + <i>&beta;</i><sup>4</sup> ) - 10(<i>&alpha;</i><sup>2</sup> + 2<i>&alpha;&beta;</i> + <i>&beta;</i><sup>2</sup>) + 147</p>48 49<p>50= 9 + 12<i>&alpha;&beta;</i> + 36 + 8<i>&alpha;&beta;</i> + 4 - 10(3 + 2<i>&alpha;&beta;</i> + 2) + 151</p>52 53<p>54= (9 + 36 + 4 - 50 + 1) + (12 + 8 - 20)<i>&alpha;&beta;</i>55</p>56 57<p>58                     = 059</p>60 61<p>62Verifying that the degree of <i>F</i>(<i>t</i>) is in fact minimum is a bit more difficult. Fortunately, under63the condition given in this problem, which is that <i>a</i> and <i>b</i> are distinct prime numbers and <i>m</i> and <i>n</i> greater than one, the degree of the minimal polynomial is always <i>mn</i>. Moreover, it is64always <i>monic</i>. That is, the coefficient of its highest-order term (<i>a<sub>d</sub></i>) is one.65</p>66 67<H2>Input</H2>68 69<p>70The input consists of multiple datasets, each in the following format.71</p>72 73<center><p>74                                         <i>   a    m   b      n</i>75</p></center>76 77<p>78This line represents <sup><i>m</i></sup>&radic;<i>a</i> + <sup><i>n</i></sup>&radic;<i>b</i>. The last dataset is followed by a single line consisting of four zeros. Numbers in a single line are separated by a single space.79</p>80<p>81Every dataset satisfies the following conditions.82</p>83 84<ol>85 86   <li>  <sup><i>m</i></sup>&radic;<i>a</i> + <sup><i>n</i></sup>&radic;<i>b</i> &le; 4.</li>87   <li> <i>mn</i> &le; 20.</li>88   <li> The coefficients of the answer <i>a</i><sub>0</sub>, ... , <i>a<sub>d</sub></i> are between (-2<sup>31</sup> + 1) and (2<sup>31</sup> - 1), inclusive.89</ol>90 91<H2>Output</H2>92 93<p>94For each dataset, output the coefficients of its minimal polynomial on integers <i>F</i>(<i>X</i>) = <i>a<sub>d</sub>X<sup>d</sup></i> + <i>a</i><sub><i>d</i>-1</sub><i>X</i><sup><i>d</i>-1</sup> + ... + <i>a</i><sub>1</sub><i>X</i> + <i>a</i><sub>0</sub>, in the following format.95</p>96 97<center><p>98                                        <i>a<sub>d</sub></i>     <i>a</i><sub><i>d</i>-1</sub>    ...   <i>a</i><sub>1</sub> <i>a</i><sub>0</sub>99</p>100</center>101 102<p>103Non-negative integers must be printed without a sign (+ or -). Numbers in a single line must104be separated by a single space and no other characters or extra spaces may appear in the output.105</p>106 107<H2>Sample Input</H2>108<pre>1093 2 2 21103 2 2 31112 2 3 411231 4 2 31133 2 2 71140 0 0 0115</pre>116 117<H2>Output for the Sample Input</H2>118<pre>1191 0 -10 0 11201 0 -9 -4 27 -36 -231211 0 -8 0 18 0 -104 0 11221 0 0 -8 -93 0 24 -2976 2883 -32 -3720 -23064 -297751231 0 -21 0 189 0 -945 -4 2835 -252 -5103 -1260 5103 -756 -2183124</pre>125 126 127 128 129