結果
| 問題 |
No.2937 Sigma Plus Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-22 16:38:42 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 300 ms |
| コード長 | 261 bytes |
| コンパイル時間 | 646 ms |
| コンパイル使用メモリ | 65,308 KB |
| 最終ジャッジ日時 | 2025-02-24 22:17:31 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <cstdint>
using namespace std;
int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
uint64_t N;
cin >> N;
if (N & UINT64_C(1))
cout << (N + 1) / 2 * N << '\n';
else
cout << N / 2 * (N + 1) << '\n';
return 0;
}