結果

問題 No.480 合計
ユーザー ブルーレヰブルーレヰ
提出日時 2020-06-19 15:28:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,433 bytes
コンパイル時間 1,927 ms
コンパイル使用メモリ 197,500 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 12:52:39
合計ジャッジ時間 2,880 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// #include <boost/range/irange.hpp>
// #define RANGE_1(e) (boost::irange(0,(e)))
// #define RANGE_2(s,e) (boost::irange((s),(e)))
// #define RANGE_3(s,e,step) (boost::irange((s), (e), (step)))
// #define RANGE_SELECTER(_1,_2,_3,SELECT,...) SELECT
// #define range(...) RANGE_SELECTER(__VA_ARGS__, RANGE_3, RANGE_2, RANGE_1) (__VA_ARGS__)
#define guard(x) if(x);
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define BIT(n) (1LL<<(n))

using namespace std;
using lint = long long;
template<typename T>class range{private:struct I{T x,s;T operator*(){return x;}bool operator!=(I&lhs){if(s<(T)0)return x>lhs.x;return x<lhs.x;}void operator++(){x=x+s;}};I i,n;public:range(T n):i({(T)0,(T)1}),n({n,(T)1}){}range(T i,T n):i({i,(T)1}),n({n,(T)1}){}range(T i,T n,T s):i({i,s}),n({n,s}){}I&begin(){return i;}I&end(){return n;}};
template<class T>lint bit(T n){return 1LL<<n;}
template<class T>bool amax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool amin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}


struct initialize{initialize(){cin.tie(nullptr);ios::sync_with_stdio(false);};}__ini__;

int sum(int x);

int main() {
    int n;
    cin >> n;
    cout << sum(n) << endl;
}

int sum(int x) {
    if (x == 1) {
        return 1;
    } else {
        return x + sum(x - 1);
    }
}
0