Monday 21 August 2023

Codeforces Round 107 Div 2 Solution:

Problem Statement Link --> Problem - 151A - Codeforces

Solution in JAVA:


import java.util.*;


public class test {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n, k, l, c, d, p, nl, np;

        n = sc.nextInt();

        k = sc.nextInt();

        l = sc.nextInt();

        c = sc.nextInt();

        d = sc.nextInt();

        p = sc.nextInt();

        nl = sc.nextInt();

        np = sc.nextInt();

        int num_of_toasts = Math.min(Math.min((k * l) / (n * nl), (c * d) / n), p / (n * np));

        System.out.println(num_of_toasts);

        sc.close();

    }

}


No comments:

Post a Comment

Good thoughtful question on Binary search on answers

Problem link:  https://leetcode.com/problems/maximize-score-of-numbers-in-ranges/description/ Solution: //import java.util.Arrays; class So...