結果
問題 |
No.2938 Sigma Sigma Distance Distance Problem
|
ユーザー |
![]() |
提出日時 | 2025-01-12 11:23:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 371 bytes |
コンパイル時間 | 3,074 ms |
コンパイル使用メモリ | 161,132 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-12 11:23:17 |
合計ジャッジ時間 | 3,058 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for( ll i = 0; i < n; i++ ) using ll = long long; int main() { int N; cin >> N; if(N < 1 || 100 < N) return 0; vector<int> a(N); rep(i, N) { cin >> a[i]; if(a[i] < 1 || 100 < a[i]) return 0; } ll ans = 0; rep(i, N) rep(j, N) { ans += abs(i - j) * abs(a[i] - a[j]); } cout << ans << endl; }