結果
問題 |
No.1096 Range Sums
|
ユーザー |
|
提出日時 | 2020-08-01 08:07:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 387 bytes |
コンパイル時間 | 797 ms |
コンパイル使用メモリ | 69,088 KB |
最終ジャッジ日時 | 2025-01-12 12:16:37 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
#include <iostream> #include <vector> using lint = long long; void solve() { int n; std::cin >> n; lint ans = 0; for (int i = 1; i <= n; ++i) { lint x; std::cin >> x; ans += x * i * (n - i + 1); } std::cout << ans << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }