結果

問題 No.2937 Sigma Plus Problem
ユーザー るこーそー
提出日時 2025-02-18 00:56:22
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 300 ms
コード長 1,013 bytes
コンパイル時間 3,259 ms
コンパイル使用メモリ 278,532 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-02-18 00:56:26
合計ジャッジ時間 4,076 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#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=(n<0);
    if (is_negative)n=-n;
    while (n!=0){
        res.push_back(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;
}
0