Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.96 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4. short wiek[2000][20000];
  5. short wiekk[200000];
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);
  10. short wysokosc;
  11. int butelki;
  12. // cout << "Hello world!" << endl;
  13. cin>>wysokosc>>butelki;
  14. int k=0;
  15. for(int i=1;i<=wysokosc;i++)
  16. {
  17. for(int j=0;j<i;j++)
  18. {
  19. cin>> wiek[i][j];
  20. wiekk[k]=wiek[i][j];
  21. k++;
  22. }
  23. }
  24. // cout<<"Wyswietl"<<endl;
  25. sort(wiekk,wiekk+k);
  26. /* for(int i=0;i<k;i++)
  27. {
  28. cout<<wiekk[i]<<endl;
  29. }
  30. for(int i=1;i<=wysokosc;i++)
  31. {
  32. for(int j=0;j<i;j++)
  33. cout<< wiek[i][j]<<"\t";
  34. cout<<endl;
  35. }*/
  36. for(int m=0;m<k;m++)
  37. {
  38. for(int i=1;i<=wysokosc;i++)
  39. {
  40. for(int j=0;j<i;j++)
  41. {
  42. if(wiekk[m]==wiek[i][j])
  43. {
  44. if((i-j)*(j+1)<=butelki)
  45. {
  46. cout<<wiekk[m]<<endl;
  47. goto wypierdalaj;
  48. }
  49. }
  50.  
  51. }
  52. }
  53. }
  54.  
  55. wypierdalaj:
  56.  
  57.  
  58.  
  59.  
  60.  
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement