結果

問題 No.1824 門\松\列
ユーザー ygd.
提出日時 2022-01-29 11:03:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 701 bytes
コンパイル時間 6,132 ms
コンパイル使用メモリ 310,480 KB
最終ジャッジ日時 2025-01-27 17:46:14
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _GLIBCXX_DEBUG //遅い可能性がある 
#include <bits/stdc++.h>
#include<atcoder/all>
using namespace atcoder;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(),(a).end() //lower_bound(ALL(a),x)
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;

int INF = 100100100;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};

ll cmb3(ll a) {
    ll ret = a * (a-1) * (a-2) /6;
    return ret;
}

int main() {
    int t;
    cin >> t;
    rep(i,t) {
        int n;
        cin >> n;
        ll ans = cmb3(n) * 4;
        cout << ans << endl;
    }
    return 0;
}


0