Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Pr1PartyProfit {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int companions = Integer.parseInt(scanner.nextLine());
- int days = Integer.parseInt(scanner.nextLine());
- int coins = days * 50;
- for (int 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 += 20 * companions;
- if (i % 3 == 0) {
- coins -= companions * 2;
- }
- }
- coins -= companions * 2;
- }
- int coinsPerPerson = coins / companions;
- System.out.printf("%d companions received %d coins each.",companions ,coinsPerPerson);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement