結果

問題 No.289 数字を全て足そう
ユーザー FVRChanFVRChan
提出日時 2017-10-02 21:16:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 1,000 ms
コード長 490 bytes
コンパイル時間 1,993 ms
コンパイル使用メモリ 74,680 KB
実行使用メモリ 55,584 KB
最終ジャッジ日時 2024-04-27 18:16:41
合計ジャッジ時間 5,886 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
53,612 KB
testcase_01 AC 105 ms
53,740 KB
testcase_02 AC 93 ms
52,104 KB
testcase_03 AC 105 ms
53,528 KB
testcase_04 AC 105 ms
53,940 KB
testcase_05 AC 141 ms
54,852 KB
testcase_06 AC 142 ms
54,068 KB
testcase_07 AC 151 ms
54,752 KB
testcase_08 AC 150 ms
55,348 KB
testcase_09 AC 132 ms
55,584 KB
testcase_10 AC 129 ms
54,444 KB
testcase_11 AC 148 ms
54,604 KB
testcase_12 AC 156 ms
55,324 KB
testcase_13 AC 146 ms
54,728 KB
testcase_14 AC 156 ms
55,024 KB
testcase_15 AC 144 ms
55,224 KB
testcase_16 AC 149 ms
55,244 KB
testcase_17 AC 155 ms
54,672 KB
testcase_18 AC 147 ms
55,516 KB
testcase_19 AC 144 ms
55,260 KB
testcase_20 AC 145 ms
54,704 KB
testcase_21 AC 103 ms
52,468 KB
testcase_22 AC 154 ms
55,336 KB
testcase_23 AC 141 ms
53,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.LinkedList;
import java.util.Scanner;
public class Main{
	private static Scanner sc=new Scanner(System.in);
	public static void main(String args[])throws Exception{
		String s=sc.nextLine();
		int sum=0;
		s=s.replaceAll("[^0-9]","");
		LinkedList<Integer>queue=new LinkedList<Integer>();
		for(char element:s.toCharArray()){
			queue.offer(Character.getNumericValue(element));
		}while(queue.isEmpty()==false){
			sum+=queue.removeFirst();
		}System.out.println(sum);
	}
}
0