結果
問題 | No.2937 Sigma Plus Problem |
ユーザー |
|
提出日時 | 2024-10-23 18:53:36 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 300 ms |
コード長 | 659 bytes |
コンパイル時間 | 3,492 ms |
コンパイル使用メモリ | 250,240 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-23 18:53:41 |
合計ジャッジ時間 | 4,773 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; istream &operator>>(istream &is, __int128_t &v) { string s; is >> s; v = 0; for(const auto &i : s) { if(isdigit(i)) { v = v * 10 + i - '0'; } } if(s[0] == '-') { v = -v; } return is; } ostream &operator<<(ostream &os, const __int128_t &v) { if(!v) { return (os << "0"); } __int128_t n = v; if(v < 0) { os << '-'; n = -n; } string s; for(; n; n /= 10) { s += (n % 10) + '0'; } ranges::reverse(s); return (os << s); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); __int128_t N; cin >> N; cout << N * (N + 1) / 2 << "\n"; }