結果

問題 No.791 うし数列
ユーザー GodNegotoGodNegoto
提出日時 2019-11-11 16:39:52
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 397 bytes
コンパイル時間 3,147 ms
コンパイル使用メモリ 72,464 KB
実行使用メモリ 57,876 KB
最終ジャッジ日時 2023-10-13 08:06:03
合計ジャッジ時間 6,478 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,844 KB
testcase_01 AC 118 ms
55,976 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 119 ms
55,848 KB
testcase_05 AC 119 ms
57,876 KB
testcase_06 AC 118 ms
55,840 KB
testcase_07 AC 120 ms
55,560 KB
testcase_08 AC 118 ms
55,972 KB
testcase_09 AC 119 ms
55,988 KB
testcase_10 AC 120 ms
56,032 KB
testcase_11 AC 121 ms
55,968 KB
testcase_12 AC 120 ms
55,808 KB
testcase_13 AC 118 ms
55,664 KB
testcase_14 AC 119 ms
55,708 KB
testcase_15 AC 118 ms
55,920 KB
testcase_16 AC 118 ms
55,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package algo;

import java.util.Scanner;

public class sample7 {

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