結果
問題 | No.2938 Sigma Sigma Distance Distance Problem |
ユーザー |
![]() |
提出日時 | 2024-10-15 22:05:56 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 337 bytes |
コンパイル時間 | 7,189 ms |
コンパイル使用メモリ | 275,700 KB |
実行使用メモリ | 13,764 KB |
最終ジャッジ日時 | 2024-10-18 22:40:18 |
合計ジャッジ時間 | 7,112 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 TLE * 1 |
ソースコード
//N <= 100 A <= 100#include <bits/stdc++.h>using namespace std;int main(){int n;cin >> n;vector<int> a(n);for(int i = 0; i < n; i++)cin >> a[i];int ans = 0;for(int i = 0; i < n; i++)for(int j = 0; j < n; j++)ans += abs(i - j) * abs(a[i] - a[j]);cout << ans << endl;}