제출 #49483

#제출 시각아이디문제언어결과실행 시간메모리
49483okaybody10Stove (JOI18_stove)C++11
100 / 100
60 ms10144 KiB
#include <bits/stdc++.h>
using namespace std;
priority_queue<int> pq;

int main()
{
    int N,K,past,now; scanf("%d %d %d",&N,&K,&now);
    for(int i=1;i<N;i++)
    {
        past=now;
        scanf("%d",&now);
        pq.push(-(now-past-1));
    }
    int ans=N;
    for(int i=0;i<N-K;i++)
    {
        ans-=pq.top();
        pq.pop();
    }
    return !printf("%d\n",ans);
}

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

stove.cpp: In function 'int main()':
stove.cpp:7:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int N,K,past,now; scanf("%d %d %d",&N,&K,&now);
                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
stove.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&now);
         ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...