結果
問題 | No.831 都市めぐり |
ユーザー | risujiroh |
提出日時 | 2019-05-24 21:29:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 440 bytes |
コンパイル時間 | 1,495 ms |
コンパイル使用メモリ | 165,476 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-17 10:27:14 |
合計ジャッジ時間 | 2,263 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; using lint = long long; template<class T = int> using V = vector<T>; template<class T = int> using VV = V< V<T> >; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); lint n; cin >> n; if (n == 1) return cout << 0 << '\n', 0; if (n & 1) { cout << (n * n * n + 3 * n * n + 5 * n - 3) / 6 << '\n'; } else { cout << (n * n * n + 3 * n * n + 5 * n - 6) / 6 << '\n'; } }