Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Цена за транспорт:
- import java.util.Scanner;
- public class Main
- {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String DayOrNight = scan.nextLine();
- int n = scan.nextInt();
- if (n >= 100){
- System.out.println(n*0.06);
- } else if(n >= 20){
- System.out.println(n*0.09);
- }else {
- if(DayOrNight.equals("Day")){
- System.out.println(0.7 + n*0.79);
- }else if(DayOrNight.equals("Night")){
- System.out.println(0.7 + n*0.9);
- }
- }
- }
- }
- Тръби в басейн:
- public class Main
- {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int v = scan.nextInt();
- double pipe1 = scan.nextDouble();
- double pipe2 = scan.nextDouble();
- double hours = scan.nextDouble();
- double water = ((pipe1*hours + pipe2*hours)/v)*100;
- if (water <= v){
- System.out.printf("The pool is %.0f%% full, pipe1: %.0f%%, pipe2: %.0f%%", water, pipe1/(pipe1+pipe2)*100, pipe2/(pipe1+pipe2)*100);
- }else {
- System.out.printf("For %f hours the pool overflows with %f liters", hours,((pipe1 + pipe2)*hours)-v);
- }
- }
- }
- Поспаливата котка Том:
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int holidays = scan.nextInt();
- int workDays = 365 - holidays;
- int totalTime = workDays*63 + holidays*127;
- double vreme = Math.abs(totalTime - 30000);
- double hours = vreme/60;
- double minutes = vreme%60;
- if (totalTime > 30000){
- System.out.println("Tom will run away");
- System.out.printf("%.0f hours and %.0f minutes more for play.", Math.floor(hours), Math.floor(minutes));
- } else{
- System.out.println("Tom will sleep well");
- System.out.printf("%.0f hours and %.0f less minutes for play.", Math.floor(hours), Math.floor(minutes));
- }
- }
- }
Add Comment
Please, Sign In to add comment