Algorithm


Problem Name: beecrowd | 3146

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

Riddles in the Dark

 

By Samuel Eduardo da Silva, IFSULDEMINAS/UFF BR Brazil

Timelimit: 1

Many things have happened since the beginning of Bilbo's journey, Gandalf and the dwarves. While passing through the Misty Mountains, Bilbo separated from his friends and ended up in Gollum's cave.

Bilbo then finds a ring and realizes that this ring belonged to Gollum, because he is desperate behind it, but Bilbo feels something coming from the ring and keeps it to himself. Gollum is suspicious, and proposes to Bilbo a game of riddles, and if Bilbo lost, it would end right there. Bilbo is forced to accept the game.

Gollum, despite being a despicable creature, is very good at math, so he asks Bilbo a question involving circumference of circles (already thinking about his ring). Bilbo is afraid he won't be able to solve the riddle, so he broke the fourth wall and is asking you to create an algorithm that, given the radius R of the circle, returns the total size of the circumference.

Oh, and Gollum said, "You can consider the value of pi as 3.14, precious."

 

Input

 

A real R value indicating the size of the circle radius of Gollum's question.

Limits: 0 <R <= 10;

 

Output

 

A real value with two decimal places indicating the total size of the circle of Gollum's question circle.

 

 

 

Input Samples Output Samples

1.00

6.28

 

 

 

3.11

19.53

 

Code Examples

#1 Code Example with C++ Programming

Code - C++ Programming


#include <iostream>
using namespace std;
int main()
{
    float r;
    cin >> r;
    if(r>0 && r <=10){
        printf("%.2f\n" , 2*r*3.14>;
    }

    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
1.00

Output

x
+
cmd
6.28

#2 Code Example with Javascript Programming

Code - Javascript Programming


const { readFileSync } = require("fs")
const [R] = readFileSync("/dev/stdin", "utf8")
	.split("\n", 1)
	.map(Number.parseFloat)

const PI = 3.14
console.log((2 * R * PI).toFixed(2))

Copy The Code & Try With Live Editor

Input

x
+
cmd
1.00

Output

x
+
cmd
6.28

#3 Code Example with Javascript Programming

Code - Javascript Programming


var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
const number = parseFloat(lines.shift());

console.log((2 * 3.14 * number).toFixed(2)); 
Copy The Code & Try With Live Editor

Input

x
+
cmd
1.00

Output

x
+
cmd
6.28

#4 Code Example with Python Programming

Code - Python Programming


print("%.2f" % (2*3.14*(float(input()))))

Copy The Code & Try With Live Editor

Input

x
+
cmd
1.00

Output

x
+
cmd
6.28
Advertisements

Demonstration


Previous
#3145 Beecrowd Online Judge Solution 3145 An unexpected Journey Solution in C, C++, Java, Js and Python
Next
#3147 Beecrowd Online Judge Solution 3147 The Battle of the Five Armies Solution in C, C++, Java, Js and Python