Advertisement
Nakumas

Egzamin PP&JP: 2014, Zad.1 B

Feb 10th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.72 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package zad1b2014;
  7.  
  8. /**
  9.  *
  10.  * @author Szymek
  11.  */
  12. public class Zad1B2014 {
  13.  
  14.     /**
  15.      * @param args the command line arguments
  16.      */
  17.     public static void main(String[] args)
  18.     {
  19.        
  20.     }
  21.     // nr skoczka 0, odleglosc 1, 5 ocen sedziow 2 3 4 5 6, miejsca na koncowa liczbe punktow 7
  22.     double[][] skoki(double tab[][], int K, int P)
  23.     {
  24.         double nrSkoczka = 0;
  25.         for(int i = 0; i < tab.length; i++)
  26.         {
  27.             //pkt za odleglosc
  28.             double punktyZaSkok = 0;
  29.             double dlugoscSkoku = (tab[i][1]-K); //obliczenie długości skoku
  30.             if(dlugoscSkoku>=0)//jeżeli ujemna, nie przeksoczyl pkt K i za kazdy metr odejmujemy P, jeżeli przeskoczył +60pkt i +P pkt
  31.                 punktyZaSkok = 60 + (dlugoscSkoku * P);
  32.             else
  33.                 punktyZaSkok = (dlugoscSkoku * ((-1)*P));
  34.            
  35.             //pkt za styl
  36.             double min = Double.MIN_VALUE;
  37.             double max = Double.MAX_VALUE;
  38.             for (int j = 2; j <= 6; j++)
  39.             {
  40.                 if(tab[i][j] > min)
  41.                     min=tab[i][j];
  42.                 if(tab[i][j] < max)
  43.                     max = tab[i][j];
  44.             }
  45.             double punktyZaStyl = 0;
  46.            
  47.             for (int j = 2; j <= 6; j++)
  48.                 punktyZaStyl += tab[i][j];
  49.            
  50.             punktyZaStyl -= min;
  51.             punktyZaStyl -= max;
  52.            
  53.             tab[i][7] = punktyZaSkok + punktyZaStyl;
  54.         }
  55.         return tab;
  56.     }
  57.    
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement