結果

問題 No.2203 POWER!!!!!
ユーザー AsahiAsahi
提出日時 2023-02-03 21:54:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 823 ms / 2,000 ms
コード長 1,282 bytes
コンパイル時間 3,061 ms
コンパイル使用メモリ 79,636 KB
実行使用メモリ 73,552 KB
最終ジャッジ日時 2023-09-15 17:39:22
合計ジャッジ時間 12,668 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,800 KB
testcase_01 AC 125 ms
55,952 KB
testcase_02 AC 126 ms
55,804 KB
testcase_03 AC 134 ms
55,864 KB
testcase_04 AC 133 ms
55,784 KB
testcase_05 AC 135 ms
55,764 KB
testcase_06 AC 136 ms
55,760 KB
testcase_07 AC 127 ms
55,588 KB
testcase_08 AC 346 ms
60,164 KB
testcase_09 AC 500 ms
60,344 KB
testcase_10 AC 717 ms
64,696 KB
testcase_11 AC 823 ms
65,064 KB
testcase_12 AC 334 ms
60,544 KB
testcase_13 AC 745 ms
73,552 KB
testcase_14 AC 748 ms
66,692 KB
testcase_15 AC 756 ms
72,596 KB
testcase_16 AC 756 ms
67,488 KB
testcase_17 AC 755 ms
66,628 KB
testcase_18 AC 124 ms
55,924 KB
testcase_19 AC 124 ms
55,604 KB
testcase_20 AC 123 ms
55,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;
import java.util.stream.Stream;

public class Main{
    /* 入出力 */
    static BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static PrintWriter output = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    /* 定数 */
    static final int [] y4 = {0,1,0,-1};
    static final int [] x4 = {1,0,-1,0};
    static final int  INF1 = Integer.MAX_VALUE;
    static final long INF2 = Long.MAX_VALUE;
    static final long MOD1 = (long)1e9+7;
    static final long MOD2 = 998244353;
    /* Main */
    public static void main(String[] args) throws IOException{
        int n = sc.nextInt();
        long answer = 0;
        Map<Long,Long> count = new HashMap<>();
        long [] A = new long[n];
        for(int i=0;i<n;i++) A[i] = sc.nextLong();
        for(int i=0;i<n;i++) {
            if(!count.containsKey(A[i])) count.put(A[i],0L);
            count.put(A[i],count.get(A[i])+1);
        }
        for(int i=0;i<n;i++) {
            for(long val : count.keySet()) {
                answer += (long)Math.pow(A[i],val)*count.get(val);
            }
        }
        output.print(answer);
        output.flush();        
    }
}
0