Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace DAKIPracticum3
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- string[] input = Console.ReadLine().Split();
- int regels = Convert.ToInt32(input[0]);
- // int lijstlimiet = Convert.ToInt32(input[1]);
- Breuk[] breuklijst = new Breuk[regels];
- for(int i = 0; i < regels; i++)
- {
- string[] inputbreuk = Console.ReadLine().Split();
- int tellertje = Convert.ToInt32(inputbreuk[0]);
- int noemertje = Convert.ToInt32(inputbreuk[1]);
- Breuk breukje = new Breuk(tellertje, noemertje);
- breuklijst[i] = breukje;
- }
- Console.WriteLine(breuklijst[0]);
- }
- public static void quicksort(int[] A, int left, int right)
- {
- if (left > right || left < 0 || right < 0) return;
- int index = partition(A, left, right);
- if (index != -1)
- {
- quicksort(A, left, index - 1);
- quicksort(A, index + 1, right);
- }
- }
- private static int partition(int[] A, int left, int right)
- {
- if (left > right) return -1;
- int end = left;
- int pivot = A[right]; // choose last one to pivot, easy to code
- for (int i = left; i < right; i++)
- {
- if (A[i] < pivot)
- {
- swap(A, i, end);
- end++;
- }
- }
- swap(A, end, right);
- return end;
- }
- private static void swap(int[] A, int left, int right)
- {
- int tmp = A[left];
- }
- static void insertionsort(IComparable[] array)
- {
- int i, j;
- for (i = 1; i < array.Length; i++)
- {
- IComparable value = array[i];
- j = i - 1;
- while ((j >= 0) && (array[j].CompareTo(value) > 0))
- {
- array[j + 1] = array[j];
- j = j - 1;
- }
- array[j + 1] = value;
- }
- }
- }
- class Breuk : IComparable<Breuk>
- {
- int teller, noemer;
- public Breuk(int t, int n)
- {
- teller = t;
- noemer = n;
- }
- public int CompareTo(Breuk breuk)
- {
- return this.teller * breuk.noemer - breuk.teller * this.teller;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement