这是一个很快的Java代码,还可以有优化的空间,但懒得优化了
参考代码:
import java.util.Scanner; public class Main { public static void main(String[] as) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int l = scanner.nextInt(); Integer[][] needs = new Integer[l][l]; boolean check = true; for (int x = 0; x < l; x++) { for (int y = 0; y < l; y++) { int input = scanner.nextInt(); if (!check) { continue; } Integer need = needs[x][y]; if (need == null) { needs[y][x] = input; } else if (need != input) { check = false; } } } if(check){ System.out.println("Yes!"); }else{ System.out.println("No!"); } } } }
0.0分
1 人评分
【蟠桃记】 (C++代码)(递归计算)浏览:976 |
C语言训练-斐波纳契数列 (C语言代码)浏览:790 |
2005年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:495 |
C语言训练-列出最简真分数序列* (C语言代码)浏览:506 |
母牛的故事 (C语言代码)浏览:435 |
不容易系列 (C语言代码)浏览:669 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:596 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)浏览:2081 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:661 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:577 |