Advertisement
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);
- int km = Integer.parseInt(scan.nextLine());
- String time = scan.nextLine();
- double price = 0.0d;
- double taxi = 0;
- if (time.equals("day")) {
- taxi = 0.79;
- } else if (time.equals("night")) {
- taxi = 0.90 ;
- }
- if (km < 20) {
- price = 0.70 + (taxi * km);
- } else if (km < 100) {
- price = 0.09 * km;
- }else{
- price = km * 0.06;
- }
- System.out.println(price);
- }
- }
- ТРЪБИ В БАСЕЙН
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int v = Integer.parseInt(scan.nextLine());
- int p1 = Integer.parseInt(scan.nextLine());
- int p2 = Integer.parseInt(scan.nextLine());
- double h = Double.parseDouble(scan.nextLine())
- double water = p1 * h+p2 * h;
- if (water <= v) {
- System.out.printf(
- "The pool is %.0f%% full. Pipe 1: %.0f%%. Pipe 2: %.0f%%.",
- Math.floor((water / v) * 100),
- Math.floor((p1 * h / water) * 100),
- Math.floor((p2 * h / water) * 100)
- );
- }else{
- System.out.printf(
- ("For %.1f hours the pool overflows with %.1f liters."),
- h,water-v);
- }
- }
- }
- ПОСПАЛИВАТА КОТКА ТОМ
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int daysOff = Integer.parseInt(scan.nextLine());
- int workDays = 365 - daysOff;
- int playTime = daysOff*127 + workDays*63;
- int diff = Math.abs(30000 - playTime);
- double hours = diff/60;
- double minutes = diff%60;
- if(playTime>30000){
- System.out.println("Tom will run away");
- System.out.printf( "%.0f hours and %.0f minutes more for play",hours,minutes);
- }else{
- System.out.println("Tom sleeps well");
- System.out.printf( "%.0f hours and %.0f minutes less for play",hours,minutes); }
- }
- }
- РЕКОЛТА
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int areaGrapeField = Integer.parseInt(scan.nextLine());
- double graperPerSquareMeter = Double.parseDouble(scan.nextLine());
- int wantedLitersWine = Integer.parseInt(scan.nextLine());
- int workers = Integer.parseInt(scan.nextLine());
- double totalGrape = areaGrapeField * graperPerSquareMeter;
- double wineLiters = (0.4 * totalGrape) / 2.5;
- double difference = 0;
- double litersPerWorker = 0;
- if (wineLiters >= wantedLitersWine){
- difference = wineLiters - wantedLitersWine;
- litersPerWorker = Math.ceil(difference / workers);
- System.out.printf(
- "Good harvest this year! Total wine: %.0f liters.%n",
- Math.floor( wineLiters));
- System.out.printf(
- "%.0f liters left -> %.0f liters per person.",
- difference, litersPerWorker);
- } else {
- difference = Math.floor(wantedLitersWine - wineLiters);
- System.out.printf(
- "It will be a tough winter! More %.0f liters wine needed.",
- difference);
- }
- }
- }
- ФИРМА
- import java.util.Scanner;
- public class Firm {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int neededHours = Integer.parseInt(scanner.nextLine());
- int days = Integer.parseInt(scanner.nextLine());
- int workers = Integer.parseInt(scanner.nextLine());
- double workDays = days * 0.9;
- double workHours = workDays * workers * (8+2);
- double hoursDif = Math.abs(neededHours - workHours);
- if (workHours >= neededHours) {
- System.out.printf("Yes!%.0f hours left.%n", Math.floor(hoursDif));
- } else {
- System.out.printf("Not enough time!%.0f hours needed.%n", Math.floor(hoursDif));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement