結果

問題 No.656 ゴルフ
ユーザー misk703
提出日時 2018-05-09 10:05:44
言語 Java
(openjdk 23)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 383 bytes
コンパイル時間 4,239 ms
コンパイル使用メモリ 77,512 KB
実行使用メモリ 41,336 KB
最終ジャッジ日時 2024-06-28 02:38:50
合計ジャッジ時間 5,700 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

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