結果
問題 |
No.632 穴埋め門松列
|
ユーザー |
![]() |
提出日時 | 2018-01-30 22:12:19 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 142 ms / 1,000 ms |
コード長 | 822 bytes |
コンパイル時間 | 2,853 ms |
コンパイル使用メモリ | 77,508 KB |
実行使用メモリ | 41,332 KB |
最終ジャッジ日時 | 2024-12-29 21:51:34 |
合計ジャッジ時間 | 4,477 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
ソースコード
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"); } } }