439A Devu, the Singer and Churu, the Joker codeforces solution in cpp
by ujjal roy
#include<bits/stdc++.h>
using namespace std;
main()
{
int n,d,i,sum=0,a,r;
cin>>n>>d;
for(i=1;i<=n;i++)
{
cin>>a;
sum+=a;
}
if(d<(n-1)*10+sum) cout<<"-1"<<endl;
else
{
r=d-sum;
cout<<r/5<<endl;
}
return 0;
}
0 Comments