結果

問題 No.933 おまわりさんこいつです
ユーザー htensaihtensai
提出日時 2019-12-09 21:44:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 661 ms / 2,000 ms
コード長 563 bytes
コンパイル時間 4,185 ms
コンパイル使用メモリ 71,940 KB
実行使用メモリ 64,972 KB
最終ジャッジ日時 2023-09-05 10:41:22
合計ジャッジ時間 11,368 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,796 KB
testcase_01 AC 121 ms
55,448 KB
testcase_02 AC 119 ms
55,732 KB
testcase_03 AC 121 ms
55,916 KB
testcase_04 AC 120 ms
55,684 KB
testcase_05 AC 121 ms
55,720 KB
testcase_06 AC 125 ms
55,828 KB
testcase_07 AC 131 ms
55,584 KB
testcase_08 AC 127 ms
55,696 KB
testcase_09 AC 129 ms
55,704 KB
testcase_10 AC 131 ms
55,824 KB
testcase_11 AC 145 ms
58,004 KB
testcase_12 AC 174 ms
55,996 KB
testcase_13 AC 201 ms
58,592 KB
testcase_14 AC 214 ms
59,428 KB
testcase_15 AC 257 ms
59,732 KB
testcase_16 AC 358 ms
60,388 KB
testcase_17 AC 483 ms
60,424 KB
testcase_18 AC 120 ms
55,700 KB
testcase_19 AC 513 ms
58,136 KB
testcase_20 AC 455 ms
60,984 KB
testcase_21 AC 120 ms
56,304 KB
testcase_22 AC 123 ms
56,224 KB
testcase_23 AC 661 ms
64,932 KB
testcase_24 AC 640 ms
64,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long ans = 1;
        for (int i = 0; i < n; i++) {
            ans = getOne(ans * getOne(sc.nextLong()));
        }
        System.out.println(ans);
    }
    
    static long getOne(long x) {
        while (x >= 10) {
            long y = 0;
            while (x > 0) {
                y += x % 10;
                x /= 10;
            }
            x = y;
        }
        return x;
    }
}
0