結果

問題 No.632 穴埋め門松列
ユーザー YukimotoPG
提出日時 2019-02-13 15:11:54
言語 Java
(openjdk 23)
結果
AC  
実行時間 137 ms / 1,000 ms
コード長 582 bytes
コンパイル時間 2,438 ms
コンパイル使用メモリ 77,040 KB
実行使用メモリ 54,224 KB
最終ジャッジ日時 2024-09-13 10:01:15
合計ジャッジ時間 3,877 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		String s = sc.nextLine().replace(" ","");
		String one = s.replace("?","1");
		String four = s.replace("?","4");
		

		
		String ans = "";
		if (one.charAt(0)<one.charAt(1)&&one.charAt(1)>one.charAt(2) || one.charAt(0)>one.charAt(1)&&one.charAt(1)<one.charAt(2)) ans += "1";
		if (four.charAt(0)<four.charAt(1)&&four.charAt(1)>four.charAt(2) || four.charAt(0)>four.charAt(1)&&four.charAt(1)<four.charAt(2)) ans += "4";
		
		System.out.println(ans);
		
	}
}
0