結果

問題 No.632 穴埋め門松列
ユーザー jimanojimano
提出日時 2018-01-23 22:45:54
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,026 bytes
コンパイル時間 4,866 ms
コンパイル使用メモリ 75,476 KB
実行使用メモリ 49,748 KB
最終ジャッジ日時 2023-08-26 23:55:55
合計ジャッジ時間 5,128 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 51 ms
49,676 KB
testcase_03 AC 51 ms
49,644 KB
testcase_04 WA -
testcase_05 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class No0632 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String[] str = br.readLine().split(" ");
			int[] matsu = new int[str.length];
			int hatena = 0;
			String ans = null;

			for (int i = 0; i < 3; i++) {
				if (str[i].equals("?")) {
					hatena = i;
					matsu[i] = 0;
				} else {
					matsu[i] = Integer.parseInt(str[i]);
				}
			}

			matsu[hatena] = 1;
			ans = isKadomatsu(matsu) ? "1" : null;
			matsu[hatena] = 4;
			ans = isKadomatsu(matsu) ? ans + "4" : null;

			System.out.println(ans);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	static boolean isKadomatsu(int[] matsu) {
		int[] tmp = { matsu[0], matsu[1], matsu[2] };
		Arrays.sort(tmp);
		return (tmp[1] != matsu[1]) && (matsu[0] != matsu[1] && matsu[1] != matsu[2] && matsu[0] != matsu[2]);
	}
}
0