結果

問題 No.791 うし数列
ユーザー tentententen
提出日時 2020-12-09 18:47:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 491 bytes
コンパイル時間 2,132 ms
コンパイル使用メモリ 77,312 KB
実行使用メモリ 41,224 KB
最終ジャッジ日時 2023-10-19 05:21:44
合計ジャッジ時間 5,477 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
40,968 KB
testcase_01 AC 125 ms
41,060 KB
testcase_02 WA -
testcase_03 AC 129 ms
41,064 KB
testcase_04 AC 133 ms
41,076 KB
testcase_05 AC 134 ms
40,648 KB
testcase_06 AC 128 ms
41,224 KB
testcase_07 AC 121 ms
39,816 KB
testcase_08 AC 124 ms
40,908 KB
testcase_09 AC 126 ms
41,132 KB
testcase_10 AC 125 ms
40,840 KB
testcase_11 AC 126 ms
40,972 KB
testcase_12 AC 124 ms
41,060 KB
testcase_13 AC 114 ms
39,804 KB
testcase_14 AC 123 ms
41,040 KB
testcase_15 AC 125 ms
40,968 KB
testcase_16 AC 123 ms
40,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] arr = sc.next().toCharArray();
        if (arr[0] != '1') {
            System.out.println(-1);
            return;
        }
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] != '3') {
                System.out.println(-1);
                return;
            }
        }
        System.out.println(arr.length - 1);
    }
}
0