結果
| 問題 |
No.2937 Sigma Plus Problem
|
| コンテスト | |
| ユーザー |
るこーそー
|
| 提出日時 | 2025-02-18 00:55:15 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 300 ms |
| コード長 | 1,065 bytes |
| コンパイル時間 | 3,695 ms |
| コンパイル使用メモリ | 277,060 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-02-18 00:55:19 |
| 合計ジャッジ時間 | 3,830 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep1(i,a) for(int i=0;i<(a);i++)
#define rep2(i,a,b) for(int i=(a);i<(b);i++)
#define rep3(i,a,b,c) for(int i=(a);((a)<=(b)?i<(b):i>(b));i+=(c))
#define rep_overload(a,b,c,d,e,...) e
#define rep(...) rep_overload(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__)
#define chmax(x,y) ((x)=max(x,y))
#define chmin(x,y) ((x)=min(x,y))
#define all(x) (x).begin(),(x).end()
string to_string(__int128 n){
if (n==0)return "0";
string res;
bool is_negative=false;
if (n<0){
is_negative=true;
n=-n;
}
while (n!=0){
res.push_back(static_cast<int>(n%10) + '0');
n/=10;
}
reverse(res.begin(),res.end());
if (is_negative)res+='-';
return res;
}
__int128_t input_int128_t(){
string s;
cin >> s;
__int128_t n=0;
for (char c:s){
n=n*10+(c-'0');
}
return n;
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
__int128_t n=input_int128_t();
cout << to_string(n*(n+1)/2) << endl;
}
るこーそー