You are viewing a single comment's thread. Return to all comments →
Scanner scan = new Scanner(System.in); int n = scan.nextInt(); scan.nextLine(); int ar[][] = new int[n][]; for(int i=0;i<n;i++){ String s[] = scan.nextLine().split(" "); ar[i] = new int[s.length]; for(int j=0;j<ar[i].length;j++){ ar[i][j] = Integer.valueOf(s[j]); } // System.out.println(Arrays.toString(ar[i])); } int qSize = scan.nextInt(); // System.out.println("Q "+qSize); for(int i=0;i<qSize;i++){ int x= scan.nextInt(); int y =scan.nextInt(); try{ System.out.println(ar[x-1][y]); }catch(Exception e){ System.out.println("ERROR!"); } } scan.close();
Seems like cookies are disabled on this browser, please enable them to open this website
Java Arraylist
You are viewing a single comment's thread. Return to all comments →