URI 1016 Solve

Solve of URI 1016 (Distance) in C & C++

How to solve:
1. In this problem, we need to calculate time.

2. Car X has a constant speed of 60 km/h and Car Y has a constant speed of 90 km/h.
3. In one hour (60 minutes) the car Y can get away one kilometer for each 2 minutes from Car X.
4. We have to find time that Car Y need to car Y to take this distance in relation to Car X.
5. Input is a single integer number as distant between X and Y.
6. Now calculate the time by multiplying the input by 2.
7. Print the result as "Result minutos" format.
See sample input and output for better understanding with printing output.
Go through problem description and see my solution for clear concept. Thanks. :)


Solution in C:
//URI online judge 1016 solution in C
//This solution is made by Mehedi Hasan Kajol


#include<stdio.h>
int main(void){
    int a;
    scanf("%d",&a);
    printf("%d minutos\n",a*2);
    return 0;
}



Solution in C++:
//URI online judge 1016 solution in C++
//This solution is made by Mehedi Hasan Kajol



#include<iostream>

using namespace std;
int main(void){
    int a;
    cin >> a;

    cout << a*2 <<" minutos" <<endl;
    return 0;
}

Post a Comment

Previous Post Next Post