/** * Use a binary search on each digit. * * Keep track of contradictory cases: * - Not giving '=' when '=' previously given or there is only one choice remaining. * - Giving '-' (i.e., too big) when we have already given the largest remaining valid value for the digit. * - Giving '+' (i.e., too small) when we have already given the smallest remaining valid value for the digit. * Number of guesses required: ceil(log_2(B)) + 1 * * @author Finn Lidbetter */ import java.util.*; public class base_finn { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int base = sc.nextInt(); int numCases = sc.nextInt(); for (int test=0; test < numCases; test++) { int numDigits = sc.nextInt(); sc.nextLine(); StringBuilder sb = new StringBuilder(); for (int i=0; i