<?php
function countMoney($creditSum, $initialFee, $percent, $comission, $payment, $payout)
{
$creditSum = $creditSum + $initialFee;
$percent = $percent + 100;
for ($i = 1; $i <= 20; $i++) {
$creditSum = $creditSum * $percent / 100 + $comission - $payout;
echo "$i m - {$creditSum}.\n";
$payment = $i * $payout;
if ($creditSum * $percent / 100 + $comission < 5000) {
$payment = $payment + ($creditSum * $percent / 100 + $creditSum + $comission);
echo "Last {$creditsum}"
break;
}
}
return $payment;
}
/* //homocredit
$creditSum = 39999;
$initialFee = 0;
$percent = 4;
$comission = 500;
$payment = 0;
$payout = 5000;
$homocredit = countMoney($creditSum,$initialFee, $percent, $comission, $payment, $payout);
echo "HomoCredit: {$homocredit} рублей.\n";*/
//softbank
$creditSum = 39999;
$initialFee = 0;
$percent = 3;
$comission = 1000;
$payment = 0;
$payout = 5000;
$softbank = countMoney($creditSum,$initialFee, $percent, $comission, $payment, $payout);
echo "SoftBank: {$softbank} рублей.\n";
/* //Strawbeerybank
$creditSum = 39999;
$initialFee = 7777;
$percent = 2;
$comission = 0;
$payment = 0;
$payout = 5000;
$stawberrybank = countMoney($creditSum,$initialFee, $percent, $comission, $payment, $payout);
echo "StrawberryBank: {$stawberrybank} рублей.\n";
$benefit = min($homocredit,$softbank,$stawberrybank);
echo "Наивыгодный кредит - {$benefit}!";*/
ICAgIDw/cGhwCiAgICBlcnJvcl9yZXBvcnRpbmcoLTEpOwogICAgZnVuY3Rpb24gY291bnRNb25leSgkY3JlZGl0U3VtLCAkaW5pdGlhbEZlZSwgJHBlcmNlbnQsICRjb21pc3Npb24sICRwYXltZW50LCAkcGF5b3V0KQogICAgewogICAgCSRjcmVkaXRTdW0gPSAkY3JlZGl0U3VtICsgJGluaXRpYWxGZWU7CiAgICAgICAgJHBlcmNlbnQgPSAkcGVyY2VudCArIDEwMDsKICAgICAgICBmb3IgKCRpID0gMTsgJGkgPD0gMjA7ICRpKyspIHsKICAgICAgICAgICAgJGNyZWRpdFN1bSA9ICRjcmVkaXRTdW0gKiAkcGVyY2VudCAvIDEwMCArICRjb21pc3Npb24gLSAkcGF5b3V0OwogICAgICAgICAgICBlY2hvICIkaSBtIC0geyRjcmVkaXRTdW19LlxuIjsKICAgICAgICAgICAgJHBheW1lbnQgICA9ICRpICogJHBheW91dDsKICAgICAgICAgICAgaWYgKCRjcmVkaXRTdW0gKiAkcGVyY2VudCAvIDEwMCArICRjb21pc3Npb24gPCA1MDAwKSB7CiAgICAgICAgICAgICAgICAkcGF5bWVudCA9ICRwYXltZW50ICsgKCRjcmVkaXRTdW0gKiAkcGVyY2VudCAvIDEwMCArICRjcmVkaXRTdW0gKyAkY29taXNzaW9uKTsKICAgICAgICAgICAgICAgIGVjaG8gIkxhc3QgeyRjcmVkaXRzdW19IgogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuICRwYXltZW50OwogICAgfQogIC8qICAvL2hvbW9jcmVkaXQKICAgICRjcmVkaXRTdW0gID0gMzk5OTk7CiAgICAJJGluaXRpYWxGZWUgPSAwOwogICAgJHBlcmNlbnQgICAgPSA0OwogICAgJGNvbWlzc2lvbiAgPSA1MDA7CiAgICAkcGF5bWVudCAgICA9IDA7CiAgICAkcGF5b3V0ICAgICA9IDUwMDA7CiAgICAkaG9tb2NyZWRpdCA9IGNvdW50TW9uZXkoJGNyZWRpdFN1bSwkaW5pdGlhbEZlZSwgJHBlcmNlbnQsICRjb21pc3Npb24sICRwYXltZW50LCAkcGF5b3V0KTsKICAgIGVjaG8gIkhvbW9DcmVkaXQ6IHskaG9tb2NyZWRpdH0g0YDRg9Cx0LvQtdC5LlxuIjsqLwogICAgLy9zb2Z0YmFuawogICAgJGNyZWRpdFN1bSAgPSAzOTk5OTsKICAgIAkkaW5pdGlhbEZlZSA9IDA7CiAgICAkcGVyY2VudCAgICA9IDM7CiAgICAkY29taXNzaW9uICA9IDEwMDA7CiAgICAkcGF5bWVudCAgICA9IDA7CiAgICAkcGF5b3V0ICA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