結果

問題 No.656 ゴルフ
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2018-04-14 14:59:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 2,027 ms
コンパイル使用メモリ 72,276 KB
実行使用メモリ 56,164 KB
最終ジャッジ日時 2023-09-09 05:06:03
合計ジャッジ時間 3,983 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,692 KB
testcase_01 AC 117 ms
55,800 KB
testcase_02 AC 116 ms
56,120 KB
testcase_03 AC 117 ms
55,744 KB
testcase_04 AC 118 ms
55,748 KB
testcase_05 AC 117 ms
55,904 KB
testcase_06 AC 116 ms
55,600 KB
testcase_07 AC 119 ms
55,404 KB
testcase_08 AC 117 ms
56,164 KB
testcase_09 AC 117 ms
55,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        System.out.println(ans(s));
    }
    
    static int ans(String s) {
        int num = 0;
        for(int i = 0; i < s.length(); i++) {
            int tmp = s.charAt(i) - '0';
            if(tmp == 0) {
                num += 10;
            } else {
                num += tmp;
            }
        }
        return num;
    }
}
0