結果

問題 No.289 数字を全て足そう
ユーザー ちよちゃんちよちゃん
提出日時 2016-05-25 14:43:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 190 ms / 1,000 ms
コード長 596 bytes
コンパイル時間 4,881 ms
コンパイル使用メモリ 74,920 KB
実行使用メモリ 44,536 KB
最終ジャッジ日時 2024-04-16 21:09:20
合計ジャッジ時間 8,376 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,412 KB
testcase_01 AC 128 ms
41,252 KB
testcase_02 AC 129 ms
41,520 KB
testcase_03 AC 129 ms
41,360 KB
testcase_04 AC 131 ms
41,360 KB
testcase_05 AC 161 ms
42,180 KB
testcase_06 AC 157 ms
41,896 KB
testcase_07 AC 180 ms
43,816 KB
testcase_08 AC 181 ms
43,588 KB
testcase_09 AC 161 ms
41,896 KB
testcase_10 AC 168 ms
42,560 KB
testcase_11 AC 180 ms
43,400 KB
testcase_12 AC 185 ms
44,388 KB
testcase_13 AC 173 ms
42,972 KB
testcase_14 AC 190 ms
44,472 KB
testcase_15 AC 177 ms
43,236 KB
testcase_16 AC 174 ms
42,784 KB
testcase_17 AC 179 ms
43,812 KB
testcase_18 AC 189 ms
44,496 KB
testcase_19 AC 183 ms
43,496 KB
testcase_20 AC 177 ms
43,516 KB
testcase_21 AC 129 ms
41,344 KB
testcase_22 AC 188 ms
44,004 KB
testcase_23 AC 185 ms
44,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Yuki289 {
	
	public static void main( String[] args ) {
	
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		scan.close();
		String[] strarr = str.split("");
		String strNumber = "[1-9]";
		Pattern p = Pattern.compile(strNumber);
		int number = 0;
		
		for (int i = 0; i < strarr.length; i++ ){
			Matcher m = p.matcher(strarr[i]);

			if(m.find()){
				number += Integer.parseInt(strarr[i].toLowerCase());
			}
		}
	    System.out.print(number);	
	}
}
0