結果

問題 No.1824 門\松\列
ユーザー hourenhouren
提出日時 2022-01-28 21:42:54
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 1,344 ms
コンパイル使用メモリ 165,836 KB
実行使用メモリ 10,844 KB
最終ジャッジ日時 2023-08-28 19:33:28
合計ジャッジ時間 1,791 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
10,664 KB
testcase_01 AC 4 ms
10,816 KB
testcase_02 AC 5 ms
10,688 KB
testcase_03 AC 20 ms
10,772 KB
testcase_04 AC 6 ms
10,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int t,n = 1000001;
    cin >> t;
    vector<ll> ans(n);
    ans[2] = 0;
    for(ll i=3;i<n;i++){
        ans[i] = ans[i-1] + (i-1)*(i-2)*2;
    }
    rep(houren,t){
        int x;
        cin >> x;
        cout << ans[x] << endl;
    }
    return 0;
}
0