# PROBLEM LINK:CodeChef: Practical coding for everyone

Practice

Author: targer_5star
Tester: targer_5star
Editorialist: targer_5star

SIMPLE

Math

# PROBLEM:

You are Given an array of size N. Followed by N integers.

You have to make every element of array Negative By Using Multiplication operation.

You can perform Multiplication operation on any element with any integer for any number of time. After performing the operation Print “YES” Without quotes. if it is possible to make every element of array negative. else print “NO” without quotes.

# EXPLANATION:

With the help of multiplication operation we can make any number negative. If we multiply it with -1. if the number if already negative the ignore it.

The only condition is that if the array contains the number “0” then it is impossible to make the whole array negative.
Because we know that if we multiply any number with zero the result is always zero which is not a negative number so the answer will be “NO”.

# SOLUTIONS:

Setter's Solution

#include<bits/stdc++.h>

using namespace std;

int main()

{

``````int t;

cin>>t;

while(t--)

{

int n,flag=0;

cin>>n;

int a[n];

for(int i=0;i<n;i++)

{

cin>>a[i];

if(a[i]==0)

{

flag=1;

}

}

if(flag==1)

{

cout<<"NO"<<"\n";

}

else

{

cout<<"YES"<<"\n";

}

}
``````

}

Tester's Solution

#include<bits/stdc++.h>

using namespace std;

int main()

{

``````int t;

cin>>t;

while(t--)

{

int n,flag=0;

cin>>n;

int a[n];

for(int i=0;i<n;i++)

{

cin>>a[i];

if(a[i]==0)

{

flag=1;

}

}

if(flag==1)

{

cout<<"NO"<<"\n";

}

else

{

cout<<"YES"<<"\n";

}

}
``````

}

Editorialist's Solution

#include<bits/stdc++.h>

using namespace std;

int main()

{

``````int t;

cin>>t;

while(t--)

{

int n,flag=0;

cin>>n;

int a[n];

for(int i=0;i<n;i++)

{

cin>>a[i];

if(a[i]==0)

{

flag=1;

}

}

if(flag==1)

{

cout<<"NO"<<"\n";

}

else

{

cout<<"YES"<<"\n";

}

}
``````

}