Algorithm


Problem Name: beecrowd | 3145

Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/3145

An unexpected Journey

 

By Samuel Eduardo da Silva, IFSULDEMINAS/UFF BR Brazil

Timelimit: 1

Bilbo Baggins lived in a hole in the ground in Vila dos Hobbits. One day, your friend Gandalf, invites you on an adventure. The adventure was based on stealing a dragon's treasure. Bilbo soon thought it would be madness to steal a dragon, but Gandalf had an entourage of dwarves with him to assist him in this toil.

Bilbo then decided to calculate how many days it would take them to reach the Lonely Mountain, where the dragon currently resides. For this calculation it would be necessary to divide the distance in kilometers from Vila dos Hobbits to the Lonely Mountain by the number of people going on the adventure (how did he come up with this metric? I don't know, hobbit things). It is noteworthy that the number of people is the number of dwarfs added to 2 (because Bilbo and Gandalf are also going on the journey).

Bilbo is very busy preparing the two breakfasts for his guests before leaving on the adventure, and then asked you, a very skilled programmer hobbit, to write a program for the calculation requested above. Gandalf provided him with a list with N names that are the dwarves that go on the adventure, and furthermore, the distance X to the Lonely Mountain.

 

Input

 

The single line at the entrance contains 2 integers, N and X, indicating respectively the number of dwarves that Gandalf managed to help in the adventure and the distance from Vila dos Hobbits to the Lonely Mountain.

Limits: 1 <N <= 100; 1 <X <= 1000.

 

Output

 

A real number with two decimal places indicating the number of days to reach the Lonely Mountain.

 

 

 

Input Samples Output Samples

2 4

1.00

 

 

 

13 1000

66.67

 

Code Examples

#1 Code Example with Javascript Programming

Code - Javascript Programming


const { readFileSync } = require("node:fs")
const [N, M] = readFileSync("/dev/stdin", "utf8")
	.split(" ", 2)
	.map(value => Number.parseInt(value, 10))

console.log((M / (N + 2)).toFixed(2))
Copy The Code & Try With Live Editor

Input

x
+
cmd
2 4

Output

x
+
cmd
1.00

#2 Code Example with Javascript Programming

Code - Javascript Programming


var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
const [A, B] = lines.shift().split(" ");

console.log(`${(parseInt(B) / (parseInt(A) + 2)).toFixed(2)}`); 
Copy The Code & Try With Live Editor

Input

x
+
cmd
2 4

Output

x
+
cmd
1.00

#3 Code Example with Python Programming

Code - Python Programming


n,x=map(int,input().split())
x=x/(n+2)
print("%.2f"%x)

Copy The Code & Try With Live Editor

Input

x
+
cmd
2 4

Output

x
+
cmd
1.00
Advertisements

Demonstration


Previous
#3142 Beecrowd Online Judge Solution 3142 Excel Bug Solution in C, C++, Java, Js and Python
Next
#3146 Beecrowd Online Judge Solution 3146 Riddles in the Dark Solution in C, C++, Java, Js and Python