結果

問題 No.1824 門\松\列
ユーザー gucci0512gucci0512
提出日時 2022-05-18 18:52:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 1,056 bytes
コンパイル時間 3,724 ms
コンパイル使用メモリ 227,204 KB
実行使用メモリ 11,380 KB
最終ジャッジ日時 2023-10-15 03:52:00
合計ジャッジ時間 4,876 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
11,360 KB
testcase_01 AC 5 ms
11,356 KB
testcase_02 AC 7 ms
11,284 KB
testcase_03 AC 22 ms
11,380 KB
testcase_04 AC 7 ms
11,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b) for(int i=b-1;i>=0;i--)
#define rbit(i,a) for(int i=0;i<(1<<a);i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
typedef long long ll;
typedef long double lld;
using namespace std;
using namespace atcoder;
using mint=static_modint<1000000007>;
const ll mod=998244353;
//const ll mod=1e9+7;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const string zton="0123456789";
const string atoz="abcdefghijklmnopqrstuvwxyz";
ll gcd(ll a,ll b){
    ll r;
    r=a%b;
    if(r==0){
        return b;
    }
    else{
        return gcd(b,r);
    }
}
typedef pair<ll,int> P;

ll ans[1010101];

int main(void){
    ans[3]=4;
    rep(i,4,1010101){
        ans[i]=ans[i-1]+(i-1)*1ll*(i-2)*2;
    }
    int t;cin >> t;
    rep(i,0,t){
        int N;cin >> N;
        cout << ans[N] << endl;
    }
}
0