Submission #971840

#TimeUsernameProblemLanguageResultExecution timeMemory
971840SunbaeStove (JOI18_stove)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> using namespace std; signed main(){ int n, k; scanf("%d %d", &n, &k); int mx = INT_MIN, mn = INT_MAX; for(int i = 0, x; i<n; ++i){ scanf("%d", &x); mx = max(mx, x); mn = min(mn, x); } printf("%d", mx - mn - k + 1); }

Compilation message (stderr)

stove.cpp: In function 'int main()':
stove.cpp:5:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |  int n, k; scanf("%d %d", &n, &k);
      |            ~~~~~^~~~~~~~~~~~~~~~~
stove.cpp:8:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |   scanf("%d", &x); mx = max(mx, x); mn = min(mn, x);
      |   ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...