結果

問題 No.411 昇順昇順ソート
ユーザー nksk38
提出日時 2017-07-05 21:27:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 500 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 73,260 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-05 20:09:17
合計ジャッジ時間 1,688 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 3 WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pl;

int main()
{
	int N, K;
	cin >> N >> K;

	ll ans = 0;
	if (N == 2 && K == 1)ans = 0;
	else {
		int num1 = N - K;
		int num2 = K - 1;
		ans = (num1*(num1 + 1)) / 2;
		if (num2 != 0)ans++;
	}
	cout << ans << endl;
	return	0;
}
0