Advertisement
NebojshaTodorovic

AIPS-Vezbi za prv kolokvium-Avtobus

Jan 17th, 2018
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 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.  
  16.        j=0;
  17.        int minimum=0;
  18.        if(M<N){
  19.            minimum=N*100;
  20.        }
  21.        else {
  22.            for (i = 0; i < N - 1; i++) {
  23.                int d = 0;
  24.                if (M - j > 0) {
  25.                    j++;
  26.                    d++;
  27.                }
  28.                if (M - j > 0) {
  29.                    j++;
  30.                    d++;
  31.                }
  32.                minimum += d * 100;
  33.                if (M - j == 0)
  34.                    break;
  35.            }
  36.            if (M - j <= 0) {
  37.                minimum += (N - i - 1) * 100;
  38.            } else {
  39.                minimum += (M - j) * 100;
  40.            }
  41.        }
  42.        int maksimum=0;
  43.        if(M==0)
  44.            maksimum=N*100;
  45.        else{
  46.            maksimum=M*100+(N-1)*100;
  47.        }
  48.            System.out.println(minimum);
  49.        System.out.println(maksimum);
  50.  
  51.     }
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement