Codechef Problem: Fuel Check (FUELCHK)
Problem Statement:
Solution:
Given,
X : units of fuel remaining
Y : fuel efficiency i.e., mileage = Y kmpl
to find: Check whether the car can travel 100 km without refueling
distance car can travel with remaining fuel = units of fuel remaining * mileage
= X * Y
condition 1 : X * Y >= 100
output: Yes , car can travel 100 km without refueling
condition 2 : X * Y < 100
output: No, car can not travel 100 km without refueling
Code Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
if (x * y >= 100) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
Comments
Post a Comment