Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $companions = intval(readline());
- $days = intval(readline());
- $coins = 0;
- for ($i = 1; $i <= $days; $i++) {
- if ($i % 10 === 0) {
- $companions -= 2;
- }
- if ($i % 15 === 0) {
- $companions += 5;
- }
- if ($i % 3 === 0) {
- $coins -= $companions * 3;
- }
- if ($i % 5 === 0) {
- $coins += $companions * 20;
- if ($i % 3 === 0) {
- $coins -= $companions * 2;
- }
- }
- $coins += 50;
- $coins -= $companions * 2;
- }
- $coinsPerCompanion = floor($coins / $companions);
- echo "$companions companions received $coinsPerCompanion coins each.";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement