Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- * Created by U_LIVT35403 on 21.05.2016.
- */
- public class Solution1 {
- public static void main(String args[]) {
- int w,h,n;
- Scanner sc=new Scanner(System.in);
- w=sc.nextInt();
- h=sc.nextInt();
- n=sc.nextInt();
- int min=Math.min(w,h); //минимальная граница
- int max=n*Math.max(w,h);//максимальная граница
- int mid;
- while(min!=max)
- {
- mid=(min+max)/2;
- if (n <= (mid / w) * (mid / h)) max=mid;//проверка условия решения задачи
- else min=mid+1;
- }
- System.out.println(min);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement