java 3641main

← разместить еще код

Расшаренный код:

package com.stepanov;
import java.awt.*;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // ввод начальных данных
        System.out.println("The program was compiled by a student of the group 1.KH201.8a Danil Stepanov.\nENTER N: ");
        int n = scanner.nextInt();
        // заполнение массива точек
        int[] xs = new int[n];
        int[] ys = new int[n];
        for (int i = 0; i < n; i++){
            System.out.println("ENTER X and Y:");
            xs[i] = scanner.nextInt();
            ys[i] = scanner.nextInt();
        }
        System.out.println("STARTING ALGORITHM...");
        List<Point> convexHull = GrahamScan.getConvexHull(xs, ys);
        System.out.println("THE RESULT:");
        for(java.awt.Point p : convexHull) {
            System.out.println("[" + (int)p.getX() + ";" + (int)p.getY() + "]");
        }
    }
}