結果
| 問題 | 
                            No.1096 Range Sums
                             | 
                    
| コンテスト | |
| ユーザー | 
                             vjudge1
                         | 
                    
| 提出日時 | 2025-08-20 21:51:35 | 
| 言語 | C++23  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 16 ms / 2,000 ms | 
| コード長 | 1,024 bytes | 
| コンパイル時間 | 3,070 ms | 
| コンパイル使用メモリ | 275,492 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-08-20 21:51:40 | 
| 合計ジャッジ時間 | 4,024 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:43:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   43 |         freopen(aris".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:44:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   44 |         freopen(aris".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include<bits/stdc++.h>
/*
    --> Programmed by katamori1310 <--
                ???
    Chillin with Blue Archive 
*/
#define int long long
#define ull unsigned long long
#define fi first
#define se second
#define aris ""
using namespace std;
const int MAXN = 100000;
const int MOD = 1e9 + 7;
const int MAXP = 1e6;
const int INF = 1e18;
const int MODE = MOD - 2;
/* 
    I love Aris and Kei at the same time
        ? ? ? Pampakapam ? ? ?
*/
inline void kei(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int n;
int a[2 * MAXN + 5];
int pfs[2 * MAXN + 5];
void solve(){
    cin >> n;
    int res = 0;
    for(int i = 1; i <= n; ++i) {
        int a;
        cin >> a;
        res += a * i * (n - i + 1);
    }
    cout << res << "\n";
}
signed main(){
    if(fopen(aris".inp", "r")){
        freopen(aris".inp", "r", stdin);
        freopen(aris".out", "w", stdout);
    }
    kei();
    int T;
    // cin >> T;
    T = 1;
    while(T--){
        solve();
    }
    return 0;
}
// ??? 
            
            
            
        
            
vjudge1