結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
![]() |
提出日時 | 2017-05-02 22:12:26 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 58 ms / 1,000 ms |
コード長 | 652 bytes |
コンパイル時間 | 2,049 ms |
コンパイル使用メモリ | 74,036 KB |
実行使用メモリ | 37,028 KB |
最終ジャッジ日時 | 2024-09-14 04:47:55 |
合計ジャッジ時間 | 4,294 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String S = reader.readLine(); int sum = 0; for (int i = 0; i < S.length(); i++) { char possibleDigit = S.charAt(i); if(Character.isDigit(possibleDigit)) { sum += Character.getNumericValue(possibleDigit); } } System.out.println(sum); } }