제출 #171700

#제출 시각아이디문제언어결과실행 시간메모리
171700dennisstarStove (JOI18_stove)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int n, k, t[1e5]; priority_queue<int, vector<int>, greater<int> > pq; int main() { scanf("%d %d", &n, &k); int ans=n, i; for (i=0; i<n; i++) scanf("%d", &t[i]); for (i=0; i<n-1; i++) pq.push(t[i+1]-t[i]-1); for (i=0; i<n-k; i++) { ans+=pq.top(); pq.pop(); } printf("%d\n", ans); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

stove.cpp:4:16: error: size of array 't' has non-integral type 'double'
 int n, k, t[1e5];
                ^
stove.cpp: In function 'int main()':
stove.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &k);
  ~~~~~^~~~~~~~~~~~~~~~~
stove.cpp:10:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (i=0; i<n; i++) scanf("%d", &t[i]);
                      ~~~~~^~~~~~~~~~~~~