Ice Cream Parlor

  • + 0 comments

    JAVA

    import java.util.Scanner; import java.util.HashMap; public class Solution { public static void main(String[]args) { Scanner scan=new Scanner(System.in); int t=scan.nextInt(); while (t-->0) { int m=scan.nextInt(); int n=scan.nextInt(); int[]costs=new int[n]; for(int i=0;imap=new HashMap(); for (int i=0;i int otherCost=money-cost; if (map.containsKey(otherCost)) { System.out.println(map.get(otherCost)+" "+icecreamID); } map.putIfAbsent(cost,icecreamID); } } }