Distance
Adapted by Neilor Tonin, URI Brazil
Timelimit: 1
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 |
Solution:
- [tab]
- C
#include <stdio.h> int main() { int d; scanf("%d", &d); int t = d/((90 / 60.0) - (60 / 60.0)); printf("%d minutos\n", t); return 0; }
- C++
#include <iostream> using namespace std; int main() { int d; cin >> d; int t = d/((90 / 60.0) - (60 / 60.0)); cout << t << " minutos" << endl; return 0; }