結果

問題 No.432 占い(Easy)
ユーザー takeya_okinotakeya_okino
提出日時 2017-10-27 21:49:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 670 bytes
コンパイル時間 2,331 ms
コンパイル使用メモリ 76,488 KB
実行使用メモリ 59,476 KB
最終ジャッジ日時 2024-05-01 16:17:49
合計ジャッジ時間 8,553 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 125 ms
41,492 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 WA -
testcase_05 RE -
testcase_06 AC 126 ms
41,408 KB
testcase_07 WA -
testcase_08 RE -
testcase_09 AC 203 ms
42,348 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 256 ms
46,956 KB
testcase_13 WA -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 266 ms
47,004 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 195 ms
42,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int t = sc.nextInt();
    for(int i = 0; i < t; i++) {
      String s = sc.next();
      while(s.length() > 1) {
        String q = "";
        for(int j = 0; j < s.length() - 1; j++) {
          int a = Integer.parseInt(String.valueOf(s.charAt(i)));
          int b = Integer.parseInt(String.valueOf(s.charAt(i + 1)));
          int c = a + b;
          if(c > 9) c = (c % 10) + 1;
          q += c; 
        }
        s = q;
      }
      int ans = Integer.parseInt(String.valueOf(s.charAt(0)));
      System.out.println(ans);
    }
  }
}
0