結果

問題 No.933 おまわりさんこいつです
ユーザー ks2mks2m
提出日時 2019-11-29 22:05:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 652 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 2,713 ms
コンパイル使用メモリ 71,228 KB
実行使用メモリ 65,044 KB
最終ジャッジ日時 2023-08-13 05:36:25
合計ジャッジ時間 9,488 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,636 KB
testcase_01 AC 123 ms
55,752 KB
testcase_02 AC 124 ms
56,084 KB
testcase_03 AC 123 ms
55,664 KB
testcase_04 AC 126 ms
55,696 KB
testcase_05 AC 129 ms
55,476 KB
testcase_06 AC 129 ms
55,476 KB
testcase_07 AC 130 ms
55,372 KB
testcase_08 AC 134 ms
55,944 KB
testcase_09 AC 135 ms
55,504 KB
testcase_10 AC 137 ms
55,836 KB
testcase_11 AC 163 ms
55,512 KB
testcase_12 AC 182 ms
56,060 KB
testcase_13 AC 201 ms
58,492 KB
testcase_14 AC 215 ms
58,904 KB
testcase_15 AC 257 ms
59,380 KB
testcase_16 AC 360 ms
59,860 KB
testcase_17 AC 501 ms
60,464 KB
testcase_18 AC 123 ms
55,504 KB
testcase_19 AC 505 ms
60,348 KB
testcase_20 AC 465 ms
60,084 KB
testcase_21 AC 123 ms
55,572 KB
testcase_22 AC 123 ms
55,808 KB
testcase_23 AC 652 ms
65,044 KB
testcase_24 AC 634 ms
64,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] p = new long[n];
		for (int i = 0; i < p.length; i++) {
			p[i] = sc.nextLong();
		}
		sc.close();

		if (n == 0) {
			System.out.println(0);
			return;
		}

		long ans = 1;
		for (int i = 0; i < n; i++) {
			if (p[i] == 0) {
				System.out.println(0);
				return;
			}
			ans *= p[i];
			ans %= 9;
		}
		if (ans == 0) {
			System.out.println(9);
		} else {
			System.out.println(ans);
		}
	}
}
0