http://codeforces.com/contest/884/problem/B
#include<bits/stdc++.h>
using namespace std;
int main()
{
int m,n,sum=0,a,num;
while (cin >> n >> m) {
for (int i = 0; i < n; i++) {
cin >> num;
sum += num ;
}
if (sum +(n-1)== m) {
cout << "YES" << endl;
}
else {
cout << "NO" << endl;
}
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int m,n,sum=0,a,num;
while (cin >> n >> m) {
for (int i = 0; i < n; i++) {
cin >> num;
sum += num ;
}
if (sum +(n-1)== m) {
cout << "YES" << endl;
}
else {
cout << "NO" << endl;
}
}
return 0;
}
No comments:
Post a Comment