Skip to content

Instantly share code, notes, and snippets.

@amulyakashyap09
Created August 11, 2018 17:52
Show Gist options
  • Save amulyakashyap09/386f2d3c0ff96ae0fe988852de0153f9 to your computer and use it in GitHub Desktop.
Save amulyakashyap09/386f2d3c0ff96ae0fe988852de0153f9 to your computer and use it in GitHub Desktop.
marut_vs_devil problem
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