Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Ciag {
- int[] sc;
- int n;
- Ciag(Scanner sc, int n) {
- this.sc = new int[n];
- for (int i = 0; i < n; i++) {
- this.sc[i] = sc.nextInt();
- this.n = n;
- }
- }
- void druk() {
- for (int i = 0; i < n; i++) {
- System.out.println(sc[i]);
- }
- }
- int inwersje() {
- int suma = 0;
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < n; j++) {
- if ((i < j) && (sc[i] > sc[j]))
- suma++;
- }
- }
- return suma;
- }
- void sortuj() {
- int zm;
- for (int i = 0; i < n; i++) {
- for (int j = 1; j < n-i; j++) {
- if (sc[j] > sc[j - 1]) {
- zm = sc[j];
- sc[j] = sc[j-1];
- sc[j-1] = zm;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement