GOV02 - Good
The problem is very easy.
You are given n terms ( the terms can be integer as well as floating ). Let S = sum of all the n terms. A number k (x<=k<=y) is said to be good if S is divisible by it.
Input
Input begins with an integer t.
Then t test cases follow.
For each test case, three numbers n,x,y are given. Then n terms of the sequence follow.
(REMEMBER: all the input is on a single line)
Output
For each test case,
You have to output a single integer m.
where, m = (sum of all even good numbers) - ( number of all odd good numbers)
(REMEMBER: all the output should be on a single line)
The numbers should be separated by spaces.
Example
Input: 2 3 1 2 1 2 3 4 1 10.5 -1 4.5 4.5 4 Output:
1 10
Scoring:
Your task is to minimise the source code length.
The less your fingers work, more you gain.
Remember:
Only python 2.7 is permitted. Sorry in advance, I will not allow any other language.
Source limit is tight. So be careful.
Constraints:
1<=t<=10
1<=n<=100
-100<=any term of sequence<=100
0<x<=y<=100
hide comments
Mitch Schwartz:
2015-02-16 14:49:29
@]V[AgN3To: I think the given cases are sufficient. If your code is mostly correct but fails for some tricky cases, I don't know what they would be; my initial approach (once I understood what the author wanted) was straightforward and passed. |
|
Aditya Pande:
2015-02-16 14:49:29
NZEC after running(2)...?
|
|
Tushar Makkar (Retired):
2015-02-16 14:49:29
Can somebody explain me How the answer of 2nd case is 10 ?
|
|
Aditya Pande:
2015-02-16 14:49:29
why am i getting NZEC....?? please help....
|
Added by: | Govind Lahoti |
Date: | 2013-01-07 |
Time limit: | 0.5s |
Source limit: | 200B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | PYTHON |
Resource: | self |