|
|
back to board#include <iostream> using namespace std; int main() { int k,n,s,i,g,r; cin>>k; s=0; cin>>n; int *a=new int[n]; for (i=0;i<n;i++){ cin>>a[i]; s=a[i]+s; }; g=s-(n*k); cout<<g; return 0; } consider this situation: when the number of the remaining cars until the current moment is less than k. for example 5 3 3 6 5 the result is 1 not 0 |
|
|