Description You have decided to manage your expenses. In order to do that, you have arranged all your bills in the form of an array. Your monthly salary is K Rs. If the total expenditure that you make is more than your salary, print "Debt". If the total expenditure is less than your monthly salary, then print "Save". If the expenditure is equal to your salary, print "Neutral". Input The first line of the input contains N, the number of elements in the array. Next line contains N space separated integers, denoting the expenses. Last line of the test case contains K, your monthly salary. Constraints 1 <= N < 100 1 <= A[i] <= 10 1 <= K <= 1000 Output Print the output as per the conditions mentioned in the problem statement. Sample Input 1 5 1 2 3 4 5 16 Sample Output 1 Save Sample Input 2 5 1 2 3 4 5 15 Sample Output 2 Neutral Hint In the first sample test case, the total expense was 15 Rs, and your salary is 16 Rs. Therefore, the output...
Description Given an array A with N positive integers. Count the number of subarrays, such that for each subarray, the sum of odd numbers exceeds the sum of even numbers. Input First line: Single integer denoting the value of T - the number of test cases. For each test case: First line: Single integer denoting the value of N. Next line: N single space-separated integers denoting the elements of array A. Constraints: 1 <= T <= 100 1 <= N<= 100 Any array elements is not greater than 100. Output For each test case, print in a new line, a single integer denoting the number of subarrays. Sample Input 1 1 5 1 2 3 4 5 Sample Output 1 9 Hint Given test cases, Test 1: N = 5. A: 1 2 3 4 5. The following subarrays having more sum of odd numbers than the sum of even numbers : 1. 1 2. 1 2 3 3. 1 2 3 4 5 4. 2 3 5. 2 3 4 5 6. 3 7. 3 4 5 8. 4 5 9. 5 Hence the answer is 9. Answer:
Comments
Post a Comment