Skip to content

Instantly share code, notes, and snippets.

View staffordsmith83's full-sized avatar

Staf Smith staffordsmith83

  • Smith Field & Spatial
  • Perth, Western Australia
View GitHub Profile
@staffordsmith83
staffordsmith83 / BusTour.java
Created August 18, 2020 09:13
A bus tour of Europe has been very successful. Due to an increase in the number of people that want to go on a tour, the tour company decided to increase the height of the bus. The new height of the bus is exactly N centimeters. But the tour’s route runs under a lot of bridges, and there is a chance that the bus will crash into one of these brid…
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int busHeight = sc.nextInt();
int numBridges = sc.nextInt();
int bridgeHeight;
boolean crash = false;