結果
| 問題 |
No.480 合計
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-16 18:19:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 3,260 bytes |
| コンパイル時間 | 1,806 ms |
| コンパイル使用メモリ | 193,852 KB |
| 最終ジャッジ日時 | 2025-02-08 20:46:15 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define all(a) begin(a), end(a)
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
if (a < b) {
a = b; // aをbで更新
return true;
}
return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
if (a > b) {
a = b; // aをbで更新
return true;
}
return false;
}
ll modpow(ll a, ll b, ll m) {
ll p = a;
ll ans = 1;
rep(i,60) {
if ((b & (1LL << i)) != 0) {
ans *= p;
ans %= m;
}
p *= p;
p %= m;
}
return (ans);
}
ll pow(ll a, ll b) {
ll p = a;
ll ans = 1;
rep(i,60) {
if ((b & (1LL << i)) != 0) {
ans *= p;
}
p *= p;
}
return (ans);
}
ll Division(ll a, ll b, ll m) {
return ((a * modpow(b, m - 2, m)) % m);
}
struct V {
int x, y;
V(int x=0, int y=0): x(x), y(y) {}
V operator-(const V &a) const {
return V(x-a.x, y-a.y);
}
int cross(const V &a) const {
return x*a.y - y*a.x;
}
int ccw(const V &a) const {
int area = cross(a);
if (area > 0) return +1; // ccw
if (area < 0) return -1; // cw
return 0; // collinear
}
};
// const ll MOD = 1000000007;
const ll MOD = 998244353;
class mint {
public:
ll x;
mint(long long x = 0) : x((x % MOD + MOD) % MOD) {}
mint& operator+=(const mint& a) {
if ((x += a.x) >= MOD) x -= MOD;
return *this;
}
mint& operator-=(const mint& a) {
if ((x += MOD - a.x) >= MOD) x -= MOD;
return *this;
}
mint& operator*=(const mint& a) {
(x *= a.x) %= MOD;
return *this;
}
mint operator+(const mint& a) const {
mint res(*this);
return res += a;
}
mint operator-(const mint& a) const {
mint res(*this);
return res -= a;
}
mint& operator++() {
++x;
if (x >= MOD) x -= MOD;
return *this;
}
mint& operator--() {
--x;
if (x < 0) x += MOD;
return *this;
}
mint operator*(const mint& a) const {
mint res(*this);
return res *= a;
}
mint pow(long long t) const {
if (!t) return 1;
mint a = pow(t >> 1);
a *= a;
if (t & 1) a *= *this;
return a;
}
// for prime mod
mint inv() const { return pow(MOD - 2); }
mint& operator/=(const mint& a) { return (*this) *= a.inv(); }
mint operator/(const mint& a) const {
mint res(*this);
return res /= a;
}
};
ostream& operator<<(ostream& os, const mint& m) {
os << m.x;
return os;
}
ostream& operator>>(ostream& os, const mint& m) {
os >> m.x;
return os;
}
bool operator==(const mint x, const mint y) { return (x.x == y.x); }
bool operator!=(const mint x, const mint y) { return !(x.x == y.x); }
bool operator>(const mint x, const mint y) { return (x.x > y.x); }
bool operator<(const mint x, const mint y) { return (y.x > x.x); }
bool operator>=(const mint x, const mint y) { return !(x.x < y.x); }
bool operator<=(const mint x, const mint y) { return !(x.x > y.x); }
/*
2147483648 int max
1000000000 1e9
9223372036854775807 ll max
1000000000000000000 1e18
*/
int main() {
int n;
cin >> n;
cout << (1+n)*n/2 << endl;
return 0;
}