結果

問題 No.1096 Range Sums
ユーザー vjudge1
提出日時 2025-08-20 21:50:58
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 1,036 bytes
コンパイル時間 3,639 ms
コンパイル使用メモリ 275,260 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-20 21:51:03
合計ジャッジ時間 4,504 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#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(long long i = 1; i <= n; ++i) {
        long long 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;
}

// ??? 
0