제출 #28275

#제출 시각아이디문제언어결과실행 시간메모리
28275ㅁㄴㅇㄹ (#68)포도주 시음 (FXCUP2_wine)C++98
0 / 1
0 ms3192 KiB
#include <bits/stdc++.h> using namespace std; int n, k, i, T[300010]; long long res=0; int main(){ scanf("%d%d", &n, &k); for(i=0; i<n; i++) scanf("%d", T+i); sort(T, T+n); for(i=0; i<k; i++){ if(i%2==0) res+=T[n-i/2-1]; else res-=T[i/2]; } printf("%lld", res); return 0; }

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

wine.cpp: In function 'int main()':
wine.cpp:6:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &k);
                       ^
wine.cpp:8:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", T+i);
                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...