Created
August 11, 2018 17:52
-
-
Save amulyakashyap09/386f2d3c0ff96ae0fe988852de0153f9 to your computer and use it in GitHub Desktop.
marut_vs_devil problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main(input) { | |
//Enter your code here | |
inputs=input.split("\n"); | |
var t=parseInt(inputs[0]); | |
var i=1; | |
var j; | |
while(t--) | |
{ | |
var D=inputs[i].split(" ").map(Number); | |
var A=inputs[++i].split(" ").map(Number); | |
i++; | |
N=D[0]; | |
E=-D[1]; | |
V=D[2]; | |
for(j=0;j<N;j++) | |
{ | |
E=E+A[j]; | |
} | |
if(E<0) | |
console.log("0"); | |
else | |
console.log(parseInt((E/V)+1)); | |
} | |
} | |
process.stdin.resume(); | |
process.stdin.setEncoding("utf-8"); | |
var stdin_input = ""; | |
process.stdin.on("data", function (input) { | |
stdin_input += input; | |
}); | |
process.stdin.on("end", function () { | |
main(stdin_input); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment