結果

問題 No.632 穴埋め門松列
ユーザー aikon_marimoaikon_marimo
提出日時 2018-01-30 22:12:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 112 ms / 1,000 ms
コード長 822 bytes
コンパイル時間 2,097 ms
コンパイル使用メモリ 77,192 KB
実行使用メモリ 41,564 KB
最終ジャッジ日時 2024-06-09 11:53:26
合計ジャッジ時間 2,968 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
41,308 KB
testcase_01 AC 105 ms
41,564 KB
testcase_02 AC 107 ms
40,164 KB
testcase_03 AC 111 ms
40,708 KB
testcase_04 AC 107 ms
41,192 KB
testcase_05 AC 109 ms
41,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder.No632;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		String S = in.nextLine();
		String S1 = S.replace("?", "1");
		String S2 = S.replace("?", "4");
		
		boolean flg1 = false;
		boolean flg2 = false;
		if (S1.charAt(0) > S1.charAt(2) && S1.charAt(2) < S1.charAt(4)) {
			flg1 = true;
		}
		if (S1.charAt(0) < S1.charAt(2) && S1.charAt(2) > S1.charAt(4)) {
			flg1 = true;
		}
		
		if (S2.charAt(0) > S2.charAt(2) && S2.charAt(2) < S2.charAt(4)) {
			flg2 = true;
		}
		if (S2.charAt(0) < S2.charAt(2) && S2.charAt(2) > S2.charAt(4)) {
			flg2 = true;
		}
		
		if (flg1 && flg2) {
			System.out.println("14");
		} else if (flg1) {
			System.out.println("1");
		} else if (flg2) {
			System.out.println("4");
		}
	}
}
0