結果
| 問題 |
No.821 Making Integers
|
| コンテスト | |
| ユーザー |
lumc_
|
| 提出日時 | 2019-04-26 21:27:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 657 bytes |
| コンパイル時間 | 803 ms |
| コンパイル使用メモリ | 100,012 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 02:00:58 |
| 合計ジャッジ時間 | 1,281 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
ソースコード
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;
// return sum of [l, r]
long long rangesum(long long l, long long r) {
return (r + l) * (r - l + 1) / 2;
}
int main() {
std::ios::sync_with_stdio(false), std::cin.tie(0);
ll n, k;
cin >> n >> k;
cout << rangesum(n - k + 1, n) + 1 << endl;
return 0;
}
lumc_