Guest User

wlodarczyk to kurwa

a guest
Nov 15th, 2019
92
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. package javaapplication2;
  3.  
  4. import java.io.*;
  5. import java.util.Random;
  6. public class JavaApplication2 {
  7.  
  8. public static void main(String[] args) throws IOException {
  9. BufferedReader pobranie=new BufferedReader(new FileReader("dane.txt"));
  10. BufferedWriter zapis=new BufferedWriter(new FileWriter("wynik.txt"));
  11. String a=pobranie.readLine();
  12. String b=pobranie.readLine();
  13. int w,k,max=0,sumac,x,y;
  14. w=Integer.parseInt(a);
  15. k=Integer.parseInt(b);
  16. int[][] tab = new int[w][k];
  17.  
  18. Random r=new Random();
  19. for (int i=0;i<w;i++)
  20. {
  21. for (int j=0;j<k;j++)
  22. {
  23. if (i==0||j==0 || i==w-1||j==k-1)
  24. {
  25. tab[i][j]=r.nextInt(90)+10;
  26. if (tab[i][j]>max)
  27. {
  28. max=tab[i][j];
  29. }
  30. }
  31. else
  32. {
  33. tab[i][j]=r.nextInt(10);
  34. }
  35. zapis.write(tab[i][j]+" ");
  36. }
  37. zapis.write("\n");
  38. }
  39. x=max%10;
  40. y=max/10;
  41. sumac=y+x;
  42. System.out.print(max+" "+sumac);
  43. zapis.close();
  44. pobranie.close();
  45. }
  46.  
  47. }
RAW Paste Data