Algorithm
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/1016
Distance
Adapted by Neilor Tonin, URI Brazil
Two cars (X and Y) leave in the same direction. The car X leaves with a constant speed of 60 km/h and the car Y leaves with a constant speed of 90 km / h.
In one hour (60 minutes) the car Y can get a distance of 30 kilometers from the X car, in other words, it can get away one kilometer for each 2 minutes.
Read the distance (in km) and calculate how long it takes (in minutes) for the car Y to take this distance in relation to the other car.
Input
The input file contains 1 integer value.
Output
Print the necessary time followed by the message "minutos" that means minutes in Portuguese.
Input Sample | Output Sample |
30 |
60 minutos |
110 |
220 minutos |
7 |
14 minutos |
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include<iostream>
using namespace std;
int main(){
int x;
cin >> x;
cout << x*2 << " minutos" << endl;
return 0;
}
Copy The Code &
Try With Live Editor
Input
Output
#2 Code Example with Java Programming
Code -
Java Programming
import java.io.IOException;
import java.util.Scanner;
public class Main{
public static void main(String[] args) throws IOException{
Scanner input = new Scanner(System.in);
int x = input.nextInt();
System.out.println((x*2)+" minutos");
}
}
Copy The Code &
Try With Live Editor
Input
Output
#3 Code Example with Javascript Programming
Code -
Javascript Programming
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
var x = parseInt(lines.shift());
console.log((x*2) +" minutos");
Copy The Code &
Try With Live Editor
Input
Output
#4 Code Example with Python Programming
Code -
Python Programming
x = int(input())
print(f"{x * 2} minutos")
Copy The Code &
Try With Live Editor
Input
Output