Created
June 7, 2019 00:02
-
-
Save nosrednawall/8fbc97283a1e2a8eae3fccc54641c333 to your computer and use it in GitHub Desktop.
solve java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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