結果

問題 No.1168 Digit Sum Sequence
ユーザー キョウチクキョウチク
提出日時 2022-05-14 12:34:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 3,590 ms
コンパイル使用メモリ 80,544 KB
実行使用メモリ 50,160 KB
最終ジャッジ日時 2023-09-30 03:19:25
合計ジャッジ時間 6,502 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
49,564 KB
testcase_01 AC 46 ms
49,472 KB
testcase_02 AC 43 ms
49,428 KB
testcase_03 AC 44 ms
49,260 KB
testcase_04 AC 43 ms
49,276 KB
testcase_05 AC 43 ms
49,112 KB
testcase_06 AC 43 ms
49,136 KB
testcase_07 AC 44 ms
49,244 KB
testcase_08 AC 44 ms
49,224 KB
testcase_09 AC 43 ms
47,172 KB
testcase_10 AC 43 ms
49,528 KB
testcase_11 AC 47 ms
49,596 KB
testcase_12 AC 46 ms
49,504 KB
testcase_13 AC 47 ms
49,524 KB
testcase_14 AC 47 ms
49,524 KB
testcase_15 AC 46 ms
49,652 KB
testcase_16 AC 46 ms
49,760 KB
testcase_17 AC 47 ms
49,460 KB
testcase_18 AC 46 ms
49,600 KB
testcase_19 AC 48 ms
49,416 KB
testcase_20 AC 46 ms
49,768 KB
testcase_21 AC 47 ms
47,568 KB
testcase_22 AC 47 ms
49,616 KB
testcase_23 AC 47 ms
49,688 KB
testcase_24 AC 47 ms
49,412 KB
testcase_25 AC 46 ms
49,492 KB
testcase_26 AC 46 ms
49,596 KB
testcase_27 AC 47 ms
50,160 KB
testcase_28 AC 46 ms
49,600 KB
testcase_29 AC 46 ms
47,948 KB
testcase_30 AC 47 ms
49,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;

public class Main {
  public static void main(String[] args) throws IOException{
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    String line=br.readLine();
    while(line.length()>1){
      int sum=0;
      for(int i=0;i<line.length();i++){
        sum+=(int)line.charAt(i)-48;
      }
      line=""+sum;
    }
    System.out.println(line);
  }
}
0