結果

問題 No.1893 Cycle
ユーザー eagleeagle
提出日時 2022-05-28 13:58:33
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 928 bytes
コンパイル時間 2,239 ms
コンパイル使用メモリ 74,228 KB
実行使用メモリ 57,704 KB
最終ジャッジ日時 2023-10-20 23:05:04
合計ジャッジ時間 6,001 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
57,524 KB
testcase_01 AC 122 ms
57,564 KB
testcase_02 AC 120 ms
57,408 KB
testcase_03 RE -
testcase_04 AC 119 ms
57,220 KB
testcase_05 RE -
testcase_06 AC 125 ms
57,380 KB
testcase_07 RE -
testcase_08 AC 117 ms
57,464 KB
testcase_09 RE -
testcase_10 AC 124 ms
57,416 KB
testcase_11 AC 121 ms
57,332 KB
testcase_12 AC 121 ms
57,500 KB
testcase_13 AC 123 ms
57,400 KB
testcase_14 AC 125 ms
57,368 KB
testcase_15 AC 123 ms
57,400 KB
testcase_16 AC 127 ms
57,348 KB
testcase_17 RE -
testcase_18 AC 129 ms
57,400 KB
testcase_19 RE -
testcase_20 AC 126 ms
57,088 KB
testcase_21 RE -
testcase_22 AC 130 ms
57,156 KB
testcase_23 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();
		//正三角形の頂点の組み合わせ
		int[][] delta = {
			{0, 4, 8},
			{1, 5, 9},
			{2, 6, 10},
			{3, 7, 11}
		};
		//与えられた値から小さい値と大きい値を取り出す
		int minVal;
		int maxVal;
		if(X > Y) {
			minVal = Y;
			maxVal = X;
		} else {
			minVal = X;
			maxVal = Y;
		}
		//どの組み合わせになるかを探す
		int index = -1;
		for(int i = 0; i < 4; i++) {
			if(delta[i][1] == minVal || delta[i][1] == maxVal) {
				index = i;
			}
		}
		//最後の値を取り出す
		int ans = -1;
		for(int i = 0; i < 3; i++) {
			if(delta[index][i] != minVal && delta[index][i] != maxVal) {
				ans = delta[index][i];
			}
		}
		System.out.println(ans);
	}
}
0