結果

問題 No.933 おまわりさんこいつです
ユーザー ks2m
提出日時 2019-11-29 22:02:54
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 2,605 ms
コンパイル使用メモリ 74,152 KB
実行使用メモリ 59,364 KB
最終ジャッジ日時 2024-11-20 22:16:10
合計ジャッジ時間 9,624 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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++) {
			ans *= p[i];
			ans %= 9;
		}
		if (ans == 0) {
			System.out.println(9);
		} else {
			System.out.println(ans);
		}
	}
}
0