Advertisement
SergeyPGUTI

10.2.5

May 28th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. /**
  5.  * Created by U_LIVT35403 on 21.05.2016.
  6.  */
  7. public class Solution1 {
  8.     public static void main(String args[]) {
  9.         int w,h,n;
  10.         Scanner sc=new Scanner(System.in);
  11.         w=sc.nextInt();
  12.         h=sc.nextInt();
  13.         n=sc.nextInt();
  14.         int min=Math.min(w,h); //минимальная граница
  15.         int max=n*Math.max(w,h);//максимальная граница
  16.         int mid;
  17.         while(min!=max)
  18.         {
  19.             mid=(min+max)/2;
  20.             if (n <= (mid / w) * (mid / h)) max=mid;//проверка условия решения задачи
  21.                 else min=mid+1;
  22.         }
  23.         System.out.println(min);
  24.  
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement