ProjectEuler is renamed to project_euler
This commit is contained in:
108
project_euler/pe/p054.html
Normal file
108
project_euler/pe/p054.html
Normal file
@@ -0,0 +1,108 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="author" content="Colin Hughes" />
|
||||
<meta name="description" content="A website dedicated to the fascinating world of mathematics and programming" />
|
||||
<meta name="keywords" content="programming,mathematics,problems,puzzles" />
|
||||
|
||||
<title>Problem 54 - Project Euler</title>
|
||||
<link rel="shortcut icon" href="http://projecteuler.net/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="style_main.css" />
|
||||
<link rel="stylesheet" type="text/css" href="style_light.css" />
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
jax: ["input/TeX", "output/HTML-CSS"],
|
||||
tex2jax: {
|
||||
inlineMath: [ ["$","$"], ["\\(","\\)"] ],
|
||||
displayMath: [ ["$$","$$"], ["\\[","\\]"] ],
|
||||
processEscapes: true
|
||||
},
|
||||
"HTML-CSS": { availableFonts: ["TeX"] }
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="container">
|
||||
|
||||
<div id="nav" class="noprint">
|
||||
<ul>
|
||||
<li><a href="about" title="About" accesskey="h">About</a></li>
|
||||
<li><a href="register" title="Register" accesskey="1">Register</a></li>
|
||||
<li id="current"><a href="problems" title="Problems" accesskey="2">Problems</a></li>
|
||||
<li><a href="login" title="Login" accesskey="3">Login</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="info_panel"><a href="rss2_euler.xml"><img src="images/icon_rss.png" alt="RSS Feed" title="RSS Feed" /></a><a href="secure=b950b"><img src="images/icon_lock.png" alt="Use secure connection" title="Use secure connection" /></a></div>
|
||||
|
||||
<div id="logo" class="noprint">
|
||||
<img src="images/pe_banner_light.png" alt="Project Euler .net" />
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<div style="text-align:center;" class="print"><img src="images/pe_banner.png" alt="projecteuler.net" style="border:none;" /></div>
|
||||
<h2>Poker hands</h2><div class="info" style="cursor:help;width:200px;margin-bottom:10px;"><h3>Problem 54</h3><span style="width:300px;color:#666;">Published on Friday, 10th October 2003, 06:00 pm; Solved by 15536</span></div>
|
||||
<div class="problem_content" role="problem">
|
||||
<p>In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way:</p>
|
||||
<ul>
|
||||
<li><b>High Card</b>: Highest value card.</li>
|
||||
<li><b>One Pair</b>: Two cards of the same value.</li>
|
||||
<li><b>Two Pairs</b>: Two different pairs.</li>
|
||||
<li><b>Three of a Kind</b>: Three cards of the same value.</li>
|
||||
<li><b>Straight</b>: All cards are consecutive values.</li>
|
||||
<li><b>Flush</b>: All cards of the same suit.</li>
|
||||
<li><b>Full House</b>: Three of a kind and a pair.</li>
|
||||
<li><b>Four of a Kind</b>: Four cards of the same value.</li>
|
||||
<li><b>Straight Flush</b>: All cards are consecutive values of same suit.</li>
|
||||
<li><b>Royal Flush</b>: Ten, Jack, Queen, King, Ace, in same suit.</li>
|
||||
</ul>
|
||||
<p>The cards are valued in the order:<br />2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace.</p>
|
||||
<p>If two players have the same ranked hands then the rank made up of the highest value wins; for example, a pair of eights beats a pair of fives (see example 1 below). But if two ranks tie, for example, both players have a pair of queens, then highest cards in each hand are compared (see example 4 below); if the highest cards tie then the next highest cards are compared, and so on.</p>
|
||||
<p>Consider the following five hands dealt to two players:</p>
|
||||
<div style="text-align:center;">
|
||||
<table>
|
||||
<tr>
|
||||
<td><b>Hand</b></td><td> </td><td><b>Player 1</b></td><td> </td><td><b>Player 2</b></td><td> </td><td><b>Winner</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align:top;"><b>1</b></td><td> </td><td>5H 5C 6S 7S KD<br /><div class="info">Pair of Fives</div></td><td> </td><td>2C 3S 8S 8D TD<br /><div class="info">Pair of Eights</div></td><td> </td><td style="vertical-align:top;">Player 2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align:top;"><b>2</b></td><td> </td><td>5D 8C 9S JS AC<br /><div class="info">Highest card Ace</div></td><td> </td><td>2C 5C 7D 8S QH<br /><div class="info">Highest card Queen</div></td><td> </td><td style="vertical-align:top;">Player 1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align:top;"><b>3</b></td><td> </td><td>2D 9C AS AH AC<br /><div class="info">Three Aces</div></td><td> </td><td>3D 6D 7D TD QD<br /><div class="info">Flush with Diamonds</div></td><td> </td><td style="vertical-align:top;">Player 2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align:top;"><b>4</b></td><td> </td><td>4D 6S 9H QH QC<br /><div class="info">Pair of Queens<br />Highest card Nine</div></td><td> </td><td>3D 6D 7H QD QS<br /><div class="info">Pair of Queens<br />Highest card Seven</div></td><td> </td><td style="vertical-align:top;">Player 1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align:top;"><b>5</b></td><td> </td><td>2H 2D 4C 4D 4S<br /><div class="info">Full House<br />With Three Fours</div></td><td> </td><td>3C 3D 3S 9S 9D<br /><div class="info">Full House<br />with Three Threes</div></td><td> </td><td style="vertical-align:top;">Player 1</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<p>The file, <a href="project/poker.txt">poker.txt</a>, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no invalid characters or repeated cards), each player's hand is in no specific order, and in each hand there is a clear winner.</p>
|
||||
<p>How many hands does Player 1 win?</p>
|
||||
</div><br />
|
||||
<br /></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="footer" class="noprint">
|
||||
<a href="copyright">Project Euler Copyright Information</a>
|
||||
<!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
|
||||
<Work rdf:about="">
|
||||
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/uk/" />
|
||||
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
|
||||
</Work>
|
||||
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/uk/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><prohibits rdf:resource="http://web.resource.org/cc/CommercialUse"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> -->
|
||||
</div>
|
||||
</div>
|
||||
<div style="height:1px;"> </div></body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user