結果

問題 No.1096 Range Sums
ユーザー ripityripity
提出日時 2021-12-14 00:11:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 633 ms / 2,000 ms
コード長 395 bytes
コンパイル時間 2,180 ms
コンパイル使用メモリ 72,060 KB
実行使用メモリ 64,220 KB
最終ジャッジ日時 2023-09-30 06:10:32
合計ジャッジ時間 7,891 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,868 KB
testcase_01 AC 120 ms
56,236 KB
testcase_02 AC 119 ms
56,068 KB
testcase_03 AC 120 ms
56,188 KB
testcase_04 AC 120 ms
56,272 KB
testcase_05 AC 123 ms
56,244 KB
testcase_06 AC 114 ms
56,084 KB
testcase_07 AC 112 ms
55,688 KB
testcase_08 AC 111 ms
56,016 KB
testcase_09 AC 117 ms
55,876 KB
testcase_10 AC 602 ms
64,220 KB
testcase_11 AC 633 ms
63,204 KB
testcase_12 AC 528 ms
62,876 KB
testcase_13 AC 547 ms
62,848 KB
testcase_14 AC 526 ms
63,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long ans = 0;
        for( int i = 0; i < N; i++ ) {
            long A = sc.nextInt();
            ans += A*(i+1)*(N-i);
        }
        
        System.out.println(ans);
        
    }
    
}
0