結果

問題 No.933 おまわりさんこいつです
ユーザー k_tsushimak_tsushima
提出日時 2020-01-01 08:54:12
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,841 bytes
コンパイル時間 1,852 ms
コンパイル使用メモリ 77,272 KB
実行使用メモリ 60,632 KB
最終ジャッジ日時 2024-05-01 11:54:52
合計ジャッジ時間 4,844 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
50,092 KB
testcase_01 AC 46 ms
50,196 KB
testcase_02 AC 47 ms
50,248 KB
testcase_03 AC 48 ms
50,240 KB
testcase_04 AC 47 ms
50,244 KB
testcase_05 AC 48 ms
50,200 KB
testcase_06 AC 48 ms
50,432 KB
testcase_07 AC 47 ms
50,276 KB
testcase_08 AC 50 ms
50,496 KB
testcase_09 AC 50 ms
50,144 KB
testcase_10 AC 49 ms
50,332 KB
testcase_11 AC 50 ms
50,316 KB
testcase_12 AC 51 ms
50,340 KB
testcase_13 AC 68 ms
51,424 KB
testcase_14 AC 87 ms
51,948 KB
testcase_15 AC 93 ms
51,976 KB
testcase_16 AC 140 ms
54,692 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 163 ms
55,132 KB
testcase_21 AC 48 ms
50,420 KB
testcase_22 AC 46 ms
50,308 KB
testcase_23 AC 223 ms
60,632 KB
testcase_24 AC 224 ms
60,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    long ans = 1;
    for (int i = 0; i < n; i++) {
      long a = sc.nextLong() % 9;
      ans = (ans * a) % 9;
    }
    System.out.println(ans == 0 ? 9 : ans);
  }
}
0