Official

A - 待ち合わせ場所 / Meeting Place Editorial by MtSaka


初心者の方へ


整数 \(N,K\) と数列 \(X\) を受け取り、\(X_K-1\) を出力させる問題です。問題文の通り実装すると正解を得られます。

実装例(C++)

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    vector<long long> x(n);
    for (auto& e : x) cin >> e;
    cout << x[k - 1] - 1 << endl;
}

posted:
last update: