Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.Vector;
- public class Main {
- public static int total;
- public static void main(String[] args) throws IOException {
- BufferedReader leitor = new BufferedReader(new InputStreamReader(System.in));
- int a = Integer.parseInt(leitor.readLine());
- int[] vet = new int[a];
- int b = 0;
- int c = 0;
- for(int q=0;q<a;q++){
- b = Integer.parseInt(leitor.readLine());
- vet[c] = b;
- c++;
- }
- Main.total =0;
- for(int i =0;i<vet.length;i++){
- for(int j = i+1;j<vet.length;j++){
- if(vet[i]>vet[j]){
- Main.total++;
- }
- }
- }
- System.out.println(Main.total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment