結果
| 問題 |
No.821 Making Integers
|
| コンテスト | |
| ユーザー |
yoshnary
|
| 提出日時 | 2019-04-26 22:15:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 436 bytes |
| コンパイル時間 | 814 ms |
| コンパイル使用メモリ | 93,208 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-25 04:31:54 |
| 合計ジャッジ時間 | 1,291 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
using ll = long long;
int main() {
ll n, k; cin >> n >> k;
ll s = n*(n + 1) / 2;
ll rev = s - (n - k)*(n - k + 1) / 2;
ll mi = s - 2 * rev;
cout << (s - mi)/2 + 1 << endl;
return 0;
}
yoshnary