Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $points = floatval(readline());
- $arenaName = readline();
- $day = readline();
- $contition = readline();
- $priceForAll = 0;
- $discount = 0;
- if($arenaName == "Nagrand"){
- if($day == "Monday" || $day =="Wednesday") {
- $discount = 0.05;
- }
- }elseif ($arenaName == "Gurubashi"){
- if($day == "Tuesday" || $day =="Thursday") {
- $discount = 0.10;
- }
- }elseif ($arenaName == "Dire Maul"){
- if($day == "Friday" || $day =="Saturday"){
- $discount = 0.07;
- }
- }
- if($contition == "Poor"){
- $priceForAll = 7000 - 7000 * $discount;
- }elseif ($contition == "Normal"){
- $priceForAll = 14000 - 14000 * $discount;
- }elseif ($contition == "Legendary"){
- $priceForAll = 21000 - 21000 * $discount;
- }
- //echo $priceForAll;
- $priceForOne = $priceForAll/5;
- $j=0;
- for ($i= 0; $i<5 ;$i++){
- if($points < $priceForOne){
- //$j++;
- break;
- }else{
- $points -=$priceForOne;
- $j++;
- }
- }
- if($j==5){
- printf("Items bought: %.0f\nArena points left: %.0f\nSuccess!",$j,$points);
- }else{
- printf("Items bought: %.0f\nArena points left: %.0f\nFailure!",$j,$points);
- }
- //echo $points;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement