結果

問題 No.432 占い(Easy)
ユーザー kenji_shioyakenji_shioya
提出日時 2016-10-22 21:39:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 250 ms / 2,000 ms
コード長 803 bytes
コンパイル時間 2,953 ms
コンパイル使用メモリ 76,764 KB
実行使用メモリ 46,656 KB
最終ジャッジ日時 2024-05-02 22:36:58
合計ジャッジ時間 8,067 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
41,372 KB
testcase_01 AC 122 ms
41,176 KB
testcase_02 AC 119 ms
39,972 KB
testcase_03 AC 118 ms
41,232 KB
testcase_04 AC 135 ms
42,496 KB
testcase_05 AC 131 ms
41,220 KB
testcase_06 AC 131 ms
41,184 KB
testcase_07 AC 128 ms
41,976 KB
testcase_08 AC 122 ms
40,236 KB
testcase_09 AC 194 ms
42,376 KB
testcase_10 AC 155 ms
42,168 KB
testcase_11 AC 158 ms
44,572 KB
testcase_12 AC 250 ms
46,656 KB
testcase_13 AC 234 ms
46,588 KB
testcase_14 AC 175 ms
45,140 KB
testcase_15 AC 130 ms
40,316 KB
testcase_16 AC 124 ms
41,560 KB
testcase_17 AC 223 ms
46,552 KB
testcase_18 AC 216 ms
46,372 KB
testcase_19 AC 224 ms
46,288 KB
testcase_20 AC 176 ms
45,824 KB
testcase_21 AC 186 ms
45,952 KB
testcase_22 AC 151 ms
42,012 KB
testcase_23 AC 170 ms
42,008 KB
testcase_24 AC 191 ms
42,756 KB
testcase_25 AC 186 ms
42,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise156 {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int number = sc.nextInt();
    for(int i = 0; i < number; i++){
      System.out.println(calc(sc.next()));
    }
  }
  public static String calc(String numStr){
    while(numStr.length() > 1){
      char[] numArray = new char[numStr.length()];
      for(int i = 0; i < numStr.length(); i++){
        numArray[i] = numStr.charAt(i);
      }
      String str = "";
      for(int i = 0; i < numStr.length() - 1; i++){
        int x = Character.getNumericValue(numArray[i]) + Character.getNumericValue(numArray[i + 1]);
        if(x > 9){
          x = x - 10 + 1;
        }
        str = str + String.valueOf(x);
      }
      numStr = str;
    }
    return numStr;
  }
}
0