답안 #886435

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
886435 2023-12-12T07:05:12 Z artixkrishna Stove (JOI18_stove) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
int main(){
        int n, k, a[1e5+5];
        vector<int> res;
        for(int i=0; i<=n; i++){
                cin>>a[i];
                if(i>1) res.push_back(a[i]-a[i-1]);
        }
        sort(res.begin(), res.end());
        int ans =n;
        for(int i=0; i<n-k; i++){
                ans+=res[i]-1;
        }
        cout<<ans;
}

Compilation message

stove.cpp: In function 'int main()':
stove.cpp:5:24: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    5 |         int n, k, a[1e5+5];
      |                     ~~~^~
stove.cpp:5:24: error: could not convert '(1.0e+5 + (double)5)' from 'double' to 'long unsigned int'
stove.cpp:5:24: error: size of array 'a' has non-integral type 'double'