PHP (Legacy)

No description

fork
loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.5483796900762887","path":"main.php","file":{"path":"main.php","content":{"asEncoding":{"base64":"PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7CgokYW1vdW50ID0gNTQ1MDA7CgokYmlsbHMgPSBbCiAgICAxMDAgPT4gMTAwLAogICAgMjAwID0+IDEwMCwKICAgIDUwMCA9PiAxMDAsCiAgICAxMDAwID0+IDEwMCwKICAgIDIwMDAgPT4gMTAwLAogICAgNTAwMCA9PiAxMDAKXTsKCiRjb3VudDEwMCA9IDA7CiRjb3VudDIwMCA9IDA7CiRjb3VudDUwMCA9IDA7CiRjb3VudDEwMDAgPSAwOwokY291bnQyMDAwID0gMDsKJGNvdW50NTAwMCA9IDA7Cgpmb3IgKCRpID0gMDsgJGFtb3VudCA+IDAgOyAkaSsrKSB7CiAgICAkbWludXM1MDAwID0gJGFtb3VudCAtIDUwMDA7CiAgICAkbWludXMyMDAwID0gJGFtb3VudCAtIDIwMDA7CiAgICAkbWludXMxMDAwID0gJGFtb3VudCAtIDEwMDA7CiAgICAkbWludXM1MDAgPSAkYW1vdW50IC0gNTAwOwogICAgJG1pbnVzMjAwID0gJGFtb3VudCAtIDIwMDsKICAgICRtaW51czEwMCA9ICRhbW91bnQgLSAxMDA7CiAgICBpZiAoKCRtaW51czUwMDAgPj0gMCkmJigkYmlsbHNbNTAwMF0+MCkpewogICAgICAgICRhbW91bnQgLT0gNTAwMDsKICAgICAgICAkY291bnQ1MDAwICsrOwogICAgICAgICRiaWxsc1s1MDAwXSAtLTsKICAgIH1lbHNlaWYgKCgkbWludXM1MDAwID49IDApJiYoJGJpbGxzWzUwMDBdPjApKSB7CiAgICAgICAgJGFtb3VudCAtPSAyMDAwOwogICAgICAgICRjb3VudDIwMDAgKys7CiAgICAgICAgJGJpbGxzWzIwMDBdIC0tOwogICAgfWVsc2VpZiAoKCRtaW51czEwMDAgPj0gMCkmJigkYmlsbHNbMTAwMF0gPiAwKSkgewogICAgICAgICRhbW91bnQgLT0gMTAwMDsKICAgICAgICAkY291bnQxMDAwICsrOwogICAgICAgICRiaWxsc1sxMDAwXSAtLTsKICAgIH1lbHNlaWYgKCgkbWludXM1MDAgPj0gMCkmJigkYmlsbHNbNTAwXSA+IDApKSB7CiAgICAgICAgJGFtb3VudCAtPSA1MDA7CiAgICAgICAgJGNvdW50NTAwICsrOwogICAgICAgICRiaWxsc1s1MDBdIC0tOwogICAgfWVsc2VpZiAoKCRtaW51czIwMCA+PSAwKSYmKCRiaWxsc1syMDBdID4gMCkpIHsKICAgICAgICAkYW1vdW50IC09IDIwMDsKICAgICAgICAkY291bnQyMDAgKys7CiAgICAgICAgJGJpbGxzWzIwMF0gLS07CiAgICB9ZWxzZWlmICgoJG1pbnVzMTAwID49IDApJiYoJGJpbGxzWzEwMF0gPiAwKSkgewogICAgICAgICRhbW91bnQgLT0gMTAwOwogICAgICAgICRjb3VudDEwMCArKzsKICAgICAgICAkYmlsbHNbMTAwXSAtLTsKICAgIH1lbHNlIHsKICAgICAgICBlY2hvICLQktGL0LTQsNGH0LAg0L3QtdCy0L7Qt9C80L7QttC90LA6INC90LXQtNC+0YHRgtCw0YLQvtGH0L3QviDQutGD0L/RjtGAIjsKICAgICAgICBleGl0KCk7CiAgICB9Cn0KCmVjaG8gItCS0YvQtNCw0YfQsCDQstC+0LfQvNC+0LbQvdCwLCDRh9C40YHQu9C+INC60YPQv9GO0YA6XG57JGNvdW50MTAwfXgxMDAgeyRjb3VudDIwMH14MjAwIHskY291bnQ1MDB9eDUwMCB7JGNvdW50MTAwMH14MTAwMCB7JGNvdW50MjAwMH14MjAwMCB7JGNvdW50NTAwMH14NTAwMCI7Cgo/Pg=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php

error_reporting(-1);

$amount = 54500;

$bills = [
    100 => 100,
    200 => 100,
    500 => 100,
    1000 => 100,
    2000 => 100,
    5000 => 100
];

$count100 = 0;
$count200 = 0;
$count500 = 0;
$count1000 = 0;
$count2000 = 0;
$count5000 = 0;

for ($i = 0; $amount > 0 ; $i++) {
    $minus5000 = $amount - 5000;
    $minus2000 = $amount - 2000;
    $minus1000 = $amount - 1000;
    $minus500 = $amount - 500;
    $minus200 = $amount - 200;
    $minus100 = $amount - 100;
    if (($minus5000 >= 0)&&($bills[5000]>0)){
        $amount -= 5000;
        $count5000 ++;
        $bills[5000] --;
    }elseif (($minus5000 >= 0)&&($bills[5000]>0)) {
        $amount -= 2000;
        $count2000 ++;
        $bills[2000] --;
    }elseif (($minus1000 >= 0)&&($bills[1000] > 0)) {
        $amount -= 1000;
        $count1000 ++;
        $bills[1000] --;
    }elseif (($minus500 >= 0)&&($bills[500] > 0)) {
        $amount -= 500;
        $count500 ++;
        $bills[500] --;
    }elseif (($minus200 >= 0)&&($bills[200] > 0)) {
        $amount -= 200;
        $count200 ++;
        $bills[200] --;
    }elseif (($minus100 >= 0)&&($bills[100] > 0)) {
        $amount -= 100;
        $count100 ++;
        $bills[100] --;
    }else {
        echo "Выдача невозможна: недостаточно купюр";
        exit();
    }
}

echo "Выдача возможна, число купюр:\n{$count100}x100 {$count200}x200 {$count500}x500 {$count1000}x1000 {$count2000}x2000 {$count5000}x5000";

?>
PHP 7.0.8 (Legacy: use the following for new features: Command-line PHP: https://repl.it/languages/php_cli PHP Web Server: https://repl.it/languages/php7