forked from keshavnandan/Topcoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathElectronicPetEasy.txt
24 lines (23 loc) · 4.98 KB
/
ElectronicPetEasy.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<html><body bgcolor="#000000" text="#ffffff"><table><tr><td colspan="2"><h3>Problem Statement</h3></td></tr><tr><td>    </td><td><p>
Kirino has found a game in which she has to feed electronic pets.
There are two pets in the game.
You are given six ints <b>st1</b>,<b>p1</b>,<b>t1</b>,<b>st2</b>,<b>p2</b>,<b>t2</b>.
To win the game, Kirino must satisfy the following rules:
<ul>
<li>She must feed her first pet for the first time precisely at the time <b>st1</b>.</li>
<li>There must be exactly <b>p1</b> seconds between any two consecutive feedings of the first pet.</li>
<li>She must feed the first pet exactly <b>t1</b> times.</li>
<li>She must feed her second pet for the first time precisely at the time <b>st2</b>.</li>
<li>There must be exactly <b>p2</b> seconds between any two consecutive feedings of the second pet.</li>
<li>She must feed the second pet exactly <b>t2</b> times.</li>
</ul>
</p>
<p>
Feeding the pets is easy if Kirino never needs to feed both pets at the same time.
Return "Easy" (quotes for clarity) if feeding the pets is easy for the given inputs.
Otherwise, return "Difficult".
Note that the return value is case-sensitive.
</p></td></tr><tr><td colspan="2"><h3>Definition</h3></td></tr><tr><td>    </td><td><table><tr><td>Class:</td><td>ElectronicPetEasy</td></tr><tr><td>Method:</td><td>isDifficult</td></tr><tr><td>Parameters:</td><td>int, int, int, int, int, int</td></tr><tr><td>Returns:</td><td>string</td></tr><tr><td>Method signature:</td><td>string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)</td></tr><tr><td colspan="2">(be sure your method is public)</td></tr></table></td></tr><tr><td colspan="2"><h3>Limits</h3></td></tr><tr><td>    </td><td><table><tr><td>Time limit (s):</td><td>2.000</td></tr><tr><td>Memory limit (MB):</td><td>256</td></tr></table></td></tr><tr><td colspan="2"><h3>Constraints</h3></td></tr><tr><td align="center" valign="top">-</td><td><b>st1</b>, <b>p1</b>, <b>t1</b>, <b>st2</b>, <b>p2</b>, and <b>t2</b> will be between 1 and 1,000, inclusive.</td></tr><tr><td colspan="2"><h3>Examples</h3></td></tr><tr><td align="center" nowrap="true">0)</td><td></td></tr><tr><td>    </td><td><table><tr><td><table><tr><td><pre>3</pre></td></tr><tr><td><pre>3</pre></td></tr><tr><td><pre>3</pre></td></tr><tr><td><pre>5</pre></td></tr><tr><td><pre>2</pre></td></tr><tr><td><pre>3</pre></td></tr></table></td></tr><tr><td><pre>Returns: "Difficult"</pre></td></tr><tr><td><table><tr><td colspan="2">Kirino must feed her first pet at the times 3, 6, and 9.
She must feed her second pet at the times 5, 7, and 9.
Feeding these two pets is difficult because she needs to feed both of them at the same time (at time 9).</td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">1)</td><td></td></tr><tr><td>    </td><td><table><tr><td><table><tr><td><pre>3</pre></td></tr><tr><td><pre>3</pre></td></tr><tr><td><pre>3</pre></td></tr><tr><td><pre>5</pre></td></tr><tr><td><pre>2</pre></td></tr><tr><td><pre>2</pre></td></tr></table></td></tr><tr><td><pre>Returns: "Easy"</pre></td></tr><tr><td><table><tr><td colspan="2">Kirino must feed her first pet at 3, 6, and 9, and her second pet at 5 and 7.
As all of these times are distinct, feeding these two pets is easy.</td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">2)</td><td></td></tr><tr><td>    </td><td><table><tr><td><table><tr><td><pre>1</pre></td></tr><tr><td><pre>4</pre></td></tr><tr><td><pre>7</pre></td></tr><tr><td><pre>1</pre></td></tr><tr><td><pre>4</pre></td></tr><tr><td><pre>7</pre></td></tr></table></td></tr><tr><td><pre>Returns: "Difficult"</pre></td></tr><tr><td><table><tr><td colspan="2"></td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">3)</td><td></td></tr><tr><td>    </td><td><table><tr><td><table><tr><td><pre>1</pre></td></tr><tr><td><pre>1000</pre></td></tr><tr><td><pre>1000</pre></td></tr><tr><td><pre>2</pre></td></tr><tr><td><pre>1000</pre></td></tr><tr><td><pre>1000</pre></td></tr></table></td></tr><tr><td><pre>Returns: "Easy"</pre></td></tr><tr><td><table><tr><td colspan="2"></td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">4)</td><td></td></tr><tr><td>    </td><td><table><tr><td><table><tr><td><pre>1</pre></td></tr><tr><td><pre>1</pre></td></tr><tr><td><pre>1</pre></td></tr><tr><td><pre>2</pre></td></tr><tr><td><pre>2</pre></td></tr><tr><td><pre>2</pre></td></tr></table></td></tr><tr><td><pre>Returns: "Easy"</pre></td></tr><tr><td><table><tr><td colspan="2"></td></tr></table></td></tr></table></td></tr></table><p>This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved. </p></body></html>