Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Problem {
- public static void main(String[] args){
- Scanner sc = new Scanner(System.in);
- long a = sc.nextLong();
- long b = sc.nextLong();
- System.out.println(calculateMaxDiamonds(a, b));
- }
- public static long calculateMaxDiamonds(long a, long b){
- long result = -404;
- long mini = Math.min(a, b);
- long maxi = Math.max(a, b);
- if(2*mini < maxi){
- result = mini;
- }else{
- result = (a+b)/3;
- }
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement