結果

問題 No.791 うし数列
ユーザー tentententen
提出日時 2020-12-09 18:48:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 2,185 ms
コンパイル使用メモリ 74,404 KB
実行使用メモリ 57,516 KB
最終ジャッジ日時 2023-10-19 05:22:18
合計ジャッジ時間 5,263 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
57,368 KB
testcase_01 AC 132 ms
57,416 KB
testcase_02 AC 130 ms
57,440 KB
testcase_03 AC 130 ms
57,388 KB
testcase_04 AC 135 ms
57,444 KB
testcase_05 AC 132 ms
57,184 KB
testcase_06 AC 134 ms
57,156 KB
testcase_07 AC 133 ms
57,420 KB
testcase_08 AC 133 ms
57,352 KB
testcase_09 AC 130 ms
57,464 KB
testcase_10 AC 132 ms
57,432 KB
testcase_11 AC 131 ms
57,056 KB
testcase_12 AC 134 ms
57,172 KB
testcase_13 AC 134 ms
57,440 KB
testcase_14 AC 132 ms
57,504 KB
testcase_15 AC 130 ms
57,516 KB
testcase_16 AC 131 ms
57,376 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' || arr.length == 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