Advertisement
Filip_Markoski

First Midterm.5 Bus (Solved)

Oct 30th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.InputStreamReader;
  3.  
  4. public class Bus {
  5.  
  6.     public static void main(String[] args) throws Exception {
  7.         int i,j,k;
  8.  
  9.         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  10.  
  11.         int N = Integer.parseInt(br.readLine());
  12.         int M = Integer.parseInt(br.readLine());
  13.  
  14.         br.close();
  15.         int min = 0;
  16.         int max = 0;
  17.         // Vasiot kod tuka
  18.         max = 100*N+(M-1)*100;
  19.  
  20.         if (M <= 1) {
  21.             max = 100*N;
  22.             min = max;
  23.         } else if (N < M) {
  24.             min = (M-N+1)*100 + (N-1)*100;
  25.         } else {
  26.             min = M*100 + (N-M)*100;
  27.         }
  28.  
  29.  
  30.         System.out.println(min);
  31.         System.out.println(max);
  32.     }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement