結果

問題 No.632 穴埋め門松列
ユーザー kohaku_kohaku
提出日時 2018-04-14 15:48:09
言語 Java
(openjdk 23)
結果
AC  
実行時間 129 ms / 1,000 ms
コード長 858 bytes
コンパイル時間 2,114 ms
コンパイル使用メモリ 75,316 KB
実行使用メモリ 54,200 KB
最終ジャッジ日時 2024-06-26 22:14:26
合計ジャッジ時間 3,496 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String [] s = new String[3];
        for(int i = 0; i < 3; i++) {
            s[i] = sc.next();
        }
        for(int i = 0; i < 3; i++) {
            if("?".equals(s[i])) {
                function(s,i);
            }
        }
        System.out.println();
    }
    
    static void function(String[]s, int index) {
        String [] replace = {"1","4"};
        for(int i = 0; i < replace.length; i++) {
            s[index] = replace[i];
            if(check(s)) {
                System.out.print(replace[i]);
            }
        }
    }
    
    static boolean check(String[]s) {
        if(s[0].compareTo(s[1]) * s[2].compareTo(s[1]) > 0) {
            return true;
        }
        return false;
    }
}
0