(UVA) Scarecrow - Solution
Link to the problem: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=3836 Every time that a crop-growing spot that is not covered by a scarecrow is found, it is assumed that the next position will receive a scarecrow. If the crop-growing spot is in the last position, and there is no scarecrow related to this spot, it will receive a scarecrow itself. The approach used was Greedy. import java.io.*; import java.util.*; class Main { public static void process() throws NumberFormatException, IOException { Scanner sc = new Scanner(System.in); int numTests = sc.nextInt(); for (int i = 0; i < numTests; i++) { int lengthField = sc.nextInt(); char[] field = new char[lengthField]; ...