97rajmath's blog

By 97rajmath, history, 4 years ago, In English

This problem was quite easy and I coded it and checked it in my local machine. And it was giving me the right answer.(passing all the pretests) but for some reason after submitting the ONLINE_JUDGE was giving me a WRONG_ANSWER response. Here is the code. Can anyone tell me what's wrong in it?

int main(){

int t;
scanf("%d",&t);
while(t--){
    int n;ll m;

    scanf("%d",&n);
    scanf("%d",&m);

    ll a[n],sum=0;
    for(int i=0;i<n;i++)
       scanf("%d",&a[i]);       

    for(int i=0;i<n;i++)
       sum+=a[i];

    if((int)sum==m)
       cout<<"YES"<<endl;
    else
       cout<<"NO"<<endl;
}   
return 0;

}

Full text and comments »

  • Vote: I like it
  • -15
  • Vote: I do not like it