답안 #678033

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
678033 2023-01-05T04:53:46 Z vjudge1 Stove (JOI18_stove) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (x).size() 
#define all(x) (x).begin(), (x).end()
 
using namespace std;
 
string alphabet = "abcdefghijklmnopqrstuvwxyz";

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ull n,k;
    cin >> n >> k;

    vector <ull> a(n),pref(n);

    ull num;

    for(ull i = 0; i < n; i++)
    {
        cin >> a[i];

        if(i == 0) num = a[0];

        pref[i] = a[i] - num;
    }

    if(k == n)
    {
        cout << n;
    }
    else if(k == 1)
    {
        cout << pref[n - 1] + 1;
    }
    else 
    {
        ull sum = 0;

        sum += pref[k - 1];

        sum += n - k;

        if(n - k == 1) sum++;

        cout << sum;
    }
    

    return 0;
}

/*
    
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -