forked from Open-CT/openct-tasks
206 lines
9.5 KiB
HTML
206 lines
9.5 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>2016-FR-19</title>
|
|
<link class="module" rel="stylesheet" href="../../modules/pemFioi/taskStyles-0.1.css" id="http://www.france-ioi.org/modules/pemFioi/taskStyles-0.1.css">
|
|
<script class="module" type="text/javascript" src="../../modules/ext/jquery/1.7/jquery.min.js" id="http://code.jquery.com/jquery-1.7.1.min.js"></script>
|
|
<script class="module" type="text/javascript" src="../../modules/ext/jquery-ui/jquery.ui.touch-punch.min.js" id="jquery.ui.touch-punch.min.js"></script>
|
|
<script class="module" type="text/javascript" src="../../modules/ext/raphael/2.2.1/raphael.min.js" id="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.2.1/raphael.min.js"></script>
|
|
|
|
<script class="module" type="text/javascript" src="../../modules/ext/json/json2.min.js" id="https://github.com/douglascrockford/JSON-js"></script>
|
|
<script class="module" type="text/javascript" src="../../modules/pemFioi/beaver-task-2.0.js" id="http://www.france-ioi.org/modules/pemFioi/beaver-task-2.0.js"></script>
|
|
|
|
<script class="module" type="text/javascript" src="../../modules/pemFioi/raphaelFactory-1.0.js" id="http://www.france-ioi.org/modules/pemFioi/raphaelFactory-1.0.js"></script>
|
|
<script class="module" type="text/javascript" src="../../modules/pemFioi/delayFactory-1.0.js" id="http://www.france-ioi.org/modules/pemFioi/delayFactory-1.0.js"></script>
|
|
<script class="module" type="text/javascript" src="../../modules/pemFioi/simulationFactory-1.0.js" id="http://www.france-ioi.org/modules/pemFioi/simulationFactory-1.0.js"></script>
|
|
|
|
<script class="module" type="text/javascript" src="../../modules/pemFioi/beav-1.0.js" id="http://www.france-ioi.org/modules/pemFioi/beav-1.0.js"></script>
|
|
<script class="module" type="text/javascript" src="../../modules/pemFioi/simulation-1.0.js" id="http://www.france-ioi.org/modules/pemFioi/simulation-1.0.js"></script>
|
|
<script class="remove" type="text/javascript" src="../../modules/integrationAPI.01/installationAPI.01/pemFioi/installation.js" id="http://www.france-ioi.org/modules/integrationAPI.01/installationAPI.01/pemFioi/installation.js"></script>
|
|
<script class="proxy module" type="text/javascript" src="../../modules/integrationAPI.01/official/platform-pr.js" id="http://www.france-ioi.org/modules/integrationAPI.01/official/platform-pr.js"></script>
|
|
<script class="stdButtonsAndMessages module" type="text/javascript" src="../../modules/integrationAPI.01/installationAPI.01/pemFioi/buttonsAndMessages.js" id="http://www.france-ioi.org/modules/integrationAPI.01/installationAPI.01/pemFioi/buttonsAndMessages.js"></script>
|
|
<script class="remove" type="text/javascript" src="../../modules/integrationAPI.01/official/miniPlatform.js" id="http://www.france-ioi.org/modules/integrationAPI.01/official/miniPlatform.js"></script>
|
|
<script class="remove" type="text/javascript">
|
|
var json = {
|
|
"id": "http://castor-informatique.fr/algorea_tasks/2016/2016-FR-19-minmax-variables/",
|
|
"language": "en",
|
|
"version": "fr.01",
|
|
"authors": "Arthur Chargueraud",
|
|
"translators": [],
|
|
"license": "",
|
|
"taskPathPrefix": "",
|
|
"modulesPathPrefix": "",
|
|
"browserSupport": [],
|
|
"fullFeedback": true,
|
|
"acceptedAnswers": [],
|
|
"usesRandomSeed": false
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="task.js"></script>
|
|
<script type="text/javascript">
|
|
var stringsLanguage = 'en';
|
|
var taskStrings = {
|
|
success: "Congratulations, you did it.",
|
|
incompleteRow: "Some lines are incomplete.",
|
|
emptyResult: function(name) { return "Your program does not indicate the number of stones to be placed in the hole " + name + "."; },
|
|
forExample: "For: ",
|
|
neverSet: function(name) {
|
|
return "Problem: Your program refers to the hole " + name + " before saying how many stones to place there.";
|
|
},
|
|
failure: function(level) {
|
|
var s = "Error: Your program does not always place in the Z-hole.";
|
|
if (level == "easy") {
|
|
s += "The largest number among A, B and C";
|
|
} else if (level == "medium") {
|
|
s += "The smallest number among A, B, C, and D";
|
|
} else if (level == "hard") {
|
|
s += "The second largest number among A, B, and C";
|
|
} else {
|
|
return "Error: Incorrect level";
|
|
}
|
|
return s + ", as the explanation to the right shows.";
|
|
}
|
|
};
|
|
</script>
|
|
<style>
|
|
|
|
#table_intro {
|
|
margin-top: 0.5em;
|
|
}
|
|
#table_intro td {
|
|
vertical-align: top;
|
|
}
|
|
#example {
|
|
border: 1px solid black;
|
|
padding: 0.5em;
|
|
width: 16em;
|
|
margin-left: 1.5em;
|
|
}
|
|
#example_code {
|
|
text-align: center;
|
|
font-weight: bold;
|
|
margin: 0.5em;
|
|
}
|
|
#descr {
|
|
}
|
|
#program {
|
|
margin-top: -0.5em;
|
|
margin-bottom: 2em;
|
|
margin-left: 0.5em;
|
|
margin-right: 0em;
|
|
}
|
|
#program_table td {
|
|
padding-top: 0.4em;
|
|
padding-bottom: 0.4em;
|
|
}
|
|
.easy .medium .hard {
|
|
display: none;
|
|
}
|
|
.arg_text_left {
|
|
display: inline-block;
|
|
width: 20px;
|
|
}
|
|
.arg_choice, .arg_text, .trace {
|
|
font-size: 150%;
|
|
}
|
|
.arg_choice, .arg_text {
|
|
font-weight: bold;
|
|
}
|
|
.arg_choice_var {
|
|
width: 2.5em;
|
|
}
|
|
.arg_choice_op {
|
|
width: 3.3em;
|
|
}
|
|
.arg_text, .arg_choice {
|
|
margin-left: 0.3em;
|
|
margin-right: 0.3em;
|
|
}
|
|
.trace {
|
|
margin-left: 2em;
|
|
}
|
|
#clean_trace_box {
|
|
height: 1.5em;
|
|
text-align: right;
|
|
margin-right: 150px;
|
|
}
|
|
#clean_trace {
|
|
display: none;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="task">
|
|
<h1>Variables</h1>
|
|
|
|
<div id="tabsContainer"></div>
|
|
<div id="taskContent">
|
|
|
|
<div>
|
|
<p class="hard"><strong style="color:red">Attention: this version is difficult, keep it for the end.</strong></p>
|
|
<p>
|
|
Jenny puts stones in holes, which are marked by letters.
|
|
</p>
|
|
<p>
|
|
We can not see the number of stones that she put in each hole.
|
|
</p>
|
|
<p>You will need function <strong class="easy hard">max</strong><strong class="medium">min</strong>, which operates in the following way:</p>
|
|
<center><div style="border: solid black 1px; width:650px;padding:5px;text-align:left">
|
|
<p><strong>Example</strong> If you could see the number of stones:
|
|
<div id="paperExampleA"></div>
|
|
<p>
|
|
<strong style="font-size:1.5em"><span id="exampleInstruction"></span></strong> Place in the hole
|
|
<span class="easy">Y</span>
|
|
<span class="medium">X</span>
|
|
<span class="hard">V</span>
|
|
<strong>the <span class="easy hard">largest</span><span class="medium">smallest</span> of the two numbers</strong> of stones between the number in the hole A and the number in the hole B :
|
|
</p>
|
|
<div id="paperExampleB"></div>
|
|
</div>
|
|
</center>
|
|
<p class="medium">The function <strong>max</strong> works in the same way but by placing <strong>the largest</strong> of the two numbers.</p>
|
|
<p class="hard">The function <strong>min</strong> works in the same way but by placing <strong>the smallest</strong> of the two numbers.</p>
|
|
<div style="height:40px"></div>
|
|
<p>
|
|
Construct a sequence of functions that places in the hole <strong>Z</strong>,
|
|
<span class="easy"><strong>the largest</strong> number among <strong>A, B and C</strong>.</span>
|
|
<span class="medium"><strong>the smallest</strong> number among <strong>A, B, C and D</strong>.</span>
|
|
<span class="hard"><strong>the second largest</strong> number among <strong>A, B and C</strong>.</span>
|
|
</p>
|
|
<center>
|
|
<div id="paperTarget" style="border: solid black 1px;width:650px;height:70px;padding-left:20px;"></div>
|
|
</center>
|
|
<p>
|
|
<strong>Attention :</strong> Your functions must work regardless of the number of stones at the start.
|
|
</p>
|
|
</div>
|
|
|
|
<div id="program">
|
|
<table id="program_table">
|
|
|
|
</table>
|
|
|
|
<div id="clean_trace_box">
|
|
<input type="button" id="clean_trace" value="Effacer les explications"/>
|
|
</div>
|
|
</div>
|
|
|
|
<img src="icon.png" style="display:none">
|
|
</div>
|
|
</div>
|
|
<!-- task -->
|
|
<div id="solution">
|
|
<h2>Solution</h2>
|
|
|
|
<p>Voici une solution possible :</p>
|
|
<div class="easy"><img src="solution_easy.png" /></div>
|
|
<div class="medium"><img src="solution_medium.png" /></div>
|
|
<!---<img src="solution_medium2.png" />-->
|
|
<div class="hard"><img src="solution_hard.png" /></div>
|
|
|
|
</div> <!-- task-solution -->
|
|
</body>
|
|
</html>
|
|
|