Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CleverLilly {
- public static void main(String[] args) {
- Scanner scanner=new Scanner(System.in);
- int godini=Integer.parseInt(scanner.nextLine());
- double peralnq=Double.parseDouble(scanner.nextLine());
- double igrachka=Double.parseDouble(scanner.nextLine());
- int igr=0;
- double sum=0;
- double startMoney=0;
- double pari=0;
- for (int i = 1; i <=godini ; i++)
- {if(i%2==1){igr++;}
- else if(i%2==0){
- startMoney=startMoney+10;
- sum=sum+startMoney;
- pari++;}
- }
- double moneyIgr=igrachka*igr;
- double broder=pari*1;
- double ost=sum+moneyIgr-broder;
- if(ost>=peralnq){double raz=ost-peralnq;
- System.out.print("Yes! ");
- System.out.printf("%.2f",raz);}
- else if(ost<peralnq){double raz1=peralnq-ost;
- System.out.print("No! ");
- System.out.printf("%.2f",raz1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement