結果

問題 No.1824 門\松\列
ユーザー ygd.ygd.
提出日時 2022-01-29 11:03:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 701 bytes
コンパイル時間 6,725 ms
コンパイル使用メモリ 321,144 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 08:26:05
合計ジャッジ時間 6,770 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 3 ms
4,384 KB
testcase_03 AC 17 ms
4,384 KB
testcase_04 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

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