Advertisement
deyanmalinov

01. Party Profit

Feb 16th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.*;
  4.  
  5. public class Main {
  6.         public static void main(String[] args) {
  7.             Scanner scan = new Scanner(System.in);
  8.             int party = Integer.parseInt(scan.nextLine());
  9.             int days = Integer.parseInt(scan.nextLine());
  10.  
  11.             int coin = days*50;
  12.  
  13.             for (int i = 1; i <= days; i++) {
  14.                 coin -= party*2;
  15.  
  16.                 if (i % 10 == 0){
  17.                     party-=2;
  18.                 }
  19.                 if (i % 15 == 0){
  20.                     party+=5;
  21.                 }
  22.                 if (i % 3 == 0){
  23.                     coin -= party*3;
  24.                 }
  25.                 if (i % 5 == 0){
  26.                     coin += party*20;
  27.                     if (i % 3 == 0){
  28.                         coin -= party*2;
  29.                     }
  30.  
  31.                 }
  32.  
  33.             }
  34.             double fin = Math.floor(coin/party);
  35.  
  36.             System.out.printf("%d companions received %.0f coins each.", party, fin);
  37.  
  38.  
  39.         }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement