I hava a problem

Revision en1, by aTSL, 2020-10-25 14:24:26

Codeforces Round #678 (Div. 2) A Reorder

My answer for test 1 is YES NO But the answer given to me in the evaluation machine is NO NO

MY CODE:

include

include

typedef long long ll; using namespace std; const int N=100005; int a[1005]; int main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int tt;cin>>tt; while(tt--) { int n,m; cin>>n>>m; for(int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+1+n); double sum=0.00; for(int i=1;i<=n;i++) { for(double j=i;j<=n;j++) { sum+=(double)a[(int)j]/j; } } if((int)sum==m) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; } /*

*/

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English aTSL 2020-10-25 14:25:37 20
en1 English aTSL 2020-10-25 14:24:26 784 Initial revision (published)