Submission #3621743


Source Code Expand

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int c[][] = new int[3][3];

		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				c[i][j] = sc.nextInt();
			}
		}

		int a[] = new int[3];
		int b[] = new int[3];

		boolean ans = false;

		for (int n = 0; n <= c[0][0]; n++) {
			a[0] = n;
			b[0] = c[0][0] - a[0];
			b[1] = c[0][1] - a[0];
			b[2] = c[0][2] - a[0];

			a[1] = c[1][0] - b[0];
			a[2] = c[2][0] - b[0];

			loop: for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if(c[i][j] == a[i] + b[j]) {
						ans = true;
					} else {
						ans = false;
						break loop;
					}
				}
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Submission Info

Submission Time
Task C - Takahashi's Information
User akizora
Language Java8 (OpenJDK 1.8.0)
Score 300
Code Size 857 Byte
Status AC
Exec Time 94 ms
Memory 23508 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 24
Set Name Test Cases
Sample sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt
All in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt
Case Name Status Exec Time Memory
in01.txt AC 92 ms 21204 KB
in02.txt AC 93 ms 20820 KB
in03.txt AC 92 ms 17876 KB
in04.txt AC 94 ms 23508 KB
in05.txt AC 93 ms 21076 KB
in06.txt AC 92 ms 21844 KB
in07.txt AC 93 ms 19284 KB
in08.txt AC 94 ms 22996 KB
in09.txt AC 94 ms 21332 KB
in10.txt AC 91 ms 20564 KB
in11.txt AC 92 ms 21716 KB
in12.txt AC 93 ms 22868 KB
in13.txt AC 93 ms 20820 KB
in14.txt AC 93 ms 21588 KB
in15.txt AC 92 ms 23124 KB
in16.txt AC 92 ms 20052 KB
in17.txt AC 93 ms 20564 KB
in18.txt AC 92 ms 19284 KB
in19.txt AC 93 ms 21204 KB
in20.txt AC 91 ms 18772 KB
sample_1.txt AC 91 ms 21716 KB
sample_2.txt AC 91 ms 20564 KB
sample_3.txt AC 91 ms 19156 KB
sample_4.txt AC 92 ms 22608 KB