//find least cost of abs values to fix given input to become 3x3 magic square import java.io.*; import java.util.*; public class MagicSquare3x3HardCode { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ // corners must be: 4, 2, 8 6 // center must b 5 //n/s/e/w sides must be 9 7, 3, 1 // opposites sum to 10 //read in data - into an int array -- use 1- 9 for convention //int[][]master;// =new int[9][9]; int[][]master= { {2,7,6, 9,5,1, 4,3,8}, {2,9,4, 7,5,3, 6,1,8}, {4,3,8, 9,5,1, 2,7,6}, {4,9,2, 3,5,7, 8,1,6}, {6,1,8, 7,5,3, 2,9,4}, {6,7,2, 1,5,9, 8,3,4}, {8,1,6, 3,5,7, 4,9,2}, {8,3,4, 1,5,9, 6,7,2} }; Scanner in = new Scanner(System.in); int m[]=new int [9]; for(int x=0; x