SHARE
TWEET

Untitled

a guest Jan 24th, 2020 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.ArrayList;
  2. import java.util.List;
  3. import java.util.Scanner;
  4.  
  5. public class Exam {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         List<Double> bird = new ArrayList<>();
  9.  
  10.         int n = scanner.nextInt();
  11.         int s = scanner.nextInt();
  12.  
  13.         for (int i = 0; i < n; i++) {
  14.             int t = scanner.nextInt();
  15.  
  16.             bird.add((i + s/((double)1/t)));
  17.         }
  18.  
  19.         int k = 0;
  20.  
  21.         for (int i = 1; i < n; i++) {
  22.             for (int j = i - 1; j >= 0; j--) {
  23.                 if (bird.get(i) < bird.get(j)) {
  24.                     k++;
  25.                 }
  26.             }
  27.         }
  28.        
  29.         System.out.println(k);
  30.     }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top