結果

問題 No.1824 門\松\列
ユーザー momoyuumomoyuu
提出日時 2023-10-26 12:45:44
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 314 bytes
コンパイル時間 3,130 ms
コンパイル使用メモリ 243,652 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-26 12:45:48
合計ジャッジ時間 3,969 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

void solve(){
    ll n;
    cin>>n;
    ll ans = n * (n-1) * (2*n-1) / 3 - (n-1) * n;
    cout<<ans<<endl;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int t;
    cin>>t;
    while(t--){
        solve();
    }
}
0