結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
![]() |
提出日時 | 2015-11-06 07:38:51 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 192 ms / 1,000 ms |
コード長 | 407 bytes |
コンパイル時間 | 5,572 ms |
コンパイル使用メモリ | 74,884 KB |
実行使用メモリ | 47,196 KB |
最終ジャッジ日時 | 2024-10-07 20:31:52 |
合計ジャッジ時間 | 7,773 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
import java.util.Scanner; public class NumberAdd { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String S = scan.next(); int c = 0; int f; for(int i=0;i<S.length();i++){ try{ char x = S.charAt(i); String y = Character.toString(x); f = Integer.parseInt(y); }catch(Exception e){ continue; } c += f; } System.out.println(c); } }