結果

問題 No.656 ゴルフ
ユーザー misk703misk703
提出日時 2018-05-09 10:05:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 383 bytes
コンパイル時間 3,796 ms
コンパイル使用メモリ 72,736 KB
実行使用メモリ 56,060 KB
最終ジャッジ日時 2023-09-10 11:15:56
合計ジャッジ時間 6,478 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,508 KB
testcase_01 AC 126 ms
55,864 KB
testcase_02 AC 123 ms
55,748 KB
testcase_03 AC 124 ms
55,684 KB
testcase_04 AC 123 ms
55,468 KB
testcase_05 AC 124 ms
56,040 KB
testcase_06 AC 124 ms
56,060 KB
testcase_07 AC 125 ms
55,796 KB
testcase_08 AC 124 ms
55,812 KB
testcase_09 AC 125 ms
55,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class golf {

    public static void main(String[] args) {
	String s ;
	Scanner scanner = new Scanner(System.in);

	s = scanner.nextLine();
	int S = Integer.parseInt(s);
	int total = 0;
	int score;
	for(int i=0;i<9;i++){
	    if((score = S % 10) == 0){
		score = 10;
	    }
	    S /= 10;
	    total += score;
	}
	System.out.println(total);
    }

}
0