- 1
Snail in the well
Try this function main() { var depth = parseInt(readLine(), 10); //your code goes h climb = 0; for(var days=1;;days++){ climb+=7; if(climb>=depth){ break; }climb-=2; } console.log(days); }
4 Antworten
+ 3
//Try this
function main() {
var depth = parseInt(readLine(), 10);
console.log(Math.ceil((depth-2)/5))
}
+ 1
mistake in for loop :
1. for ([initialExpression]; [conditionExpression]; [incrementExpression])
where is your condition
2. Call the function main()
0
function main() {
var depth = parseInt(readLine(), 10);
//your code goes here
var day=0;
var i;
for( i=0; day < depth; i++)
{
day += 7;
if(day >= depth)
{
i += 1;
break;
}
day -= 2;
}
console.log(i);
}