結果

問題 No.411 昇順昇順ソート
ユーザー phspls
提出日時 2020-04-05 12:37:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 394 bytes
コンパイル時間 1,576 ms
コンパイル使用メモリ 165,252 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-03 08:07:47
合計ジャッジ時間 2,617 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 3 WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define llong long long

int main() {
    int n, k;
    cin >> n >> k;

    int result;
    if(k == 1) result = n - 2;
    else if(n==k) result = 1;
    else {
        result = 1;
        for(int i=k+1; i<=n; i++) {
            result += n - i + 1;
        }
    }

    cout << result << endl;
}
0