Skip to content

Instantly share code, notes, and snippets.

@nosrednawall
Created June 7, 2019 00:02
Show Gist options
  • Save nosrednawall/8fbc97283a1e2a8eae3fccc54641c333 to your computer and use it in GitHub Desktop.
Save nosrednawall/8fbc97283a1e2a8eae3fccc54641c333 to your computer and use it in GitHub Desktop.
solve java
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class Solution {
// Complete the diagonalDifference function below.
static int diagonalDifference(int[][] arr) {
for(int[] a : arr){
int diagonalEsquerda = 0;
int diagonalDireita = 0;
int posicaoArrayA = 0;
int posicaoArrayB = 0;
for(int b : a){
if(posicaoArrayB == 0 && posicaoArrayA == 0){
}
}
}
}
private static final Scanner scanner = new Scanner(System.in);
public static void main(String[] args) throws IOException {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
int n = scanner.nextInt();
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
int[][] arr = new int[n][n];
for (int i = 0; i < n; i++) {
String[] arrRowItems = scanner.nextLine().split(" ");
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
for (int j = 0; j < n; j++) {
int arrItem = Integer.parseInt(arrRowItems[j]);
arr[i][j] = arrItem;
}
}
int result = diagonalDifference(arr);
bufferedWriter.write(String.valueOf(result));
bufferedWriter.newLine();
bufferedWriter.close();
scanner.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment