MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

CodeChef_problems/WATERMELON/SOLUTION.cpp:4–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2using namespace std;
3
4int main() {
5 // your code goes here
6
7 int t;
8 cin>>t;
9
10 while(t--)
11 {
12 int n,sum=0;
13 cin>>n;
14 int arr[n+2];
15//i have taken an array with increased size because sometimes tight arrays throws bound error
16//and in this case it was
17
18 for(int i=0;i<n;i++){
19 cin>> arr[i];
20 sum=sum+arr[i];
21 }
22//then i stored the sum of array elements in a variable sum
23//if it was greater or equal to zero the output says YES
24 if(sum>=0){
25 cout<<"YES"<<endl;
26 }
27//else no
28
29 else{
30 cout<<"NO"<<endl;
31 }
32
33
34 }
35 return 0;
36}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected