水題
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,d,t; cin >> n >> d; for(int i = 0 ; i < n; ++ i){ cin >> t; d-=t; } d-=(n-1)*10; if(d < 0) cout<<-1<<endl; else cout<<(n-1)*2+d/5<<endl; }
水題
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,d,t; cin >> n >> d; for(int i = 0 ; i < n; ++ i){ cin >> t; d-=t; } d-=(n-1)*10; if(d < 0) cout<<-1<<endl; else cout<<(n-1)*2+d/5<<endl; }