Algorithm
Problem Name: beecrowd | 1959
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/1959
Regular Simple Polygons
By M.C. Pinto, UNILA Brazil
Timelimit: 1
In Euclidean geometry, a regular polygon is a polygon that is equiangular (all angles are equal in measure) and equilateral (all sides have the same length). A simple polygon is one that does not intersect itself anywhere. Below we can see various mosaics made of regular polygons.
You must write a program that, given the number and the length of sides of a regular polygon, show its perimeter.
Input
The input are two positive integers: N and L, which are, respectively, the number of sides and the length of each side of a regular polygon (3 ≤ N ≤ 1000000 and 1 ≤ L ≤ 4000).
Output
The output is the perimeter P of the regular polygon in a single line.
Input Samples | Output Samples |
3 1 |
3 |
9 8 |
72 |
1000000 1000 |
1000000000 |
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include<iostream>
#include<iomanip>
using namespace std;
int main() {
long long A, B;
while(cin >> A >> B) {
cout << A*B << endl;
}
}
Copy The Code &
Try With Live Editor
Input
Output
#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(a * b);
Copy The Code &
Try With Live Editor
Input
Output