Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- short wiek[2000][20000];
- short wiekk[200000];
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- short wysokosc;
- int butelki;
- // cout << "Hello world!" << endl;
- cin>>wysokosc>>butelki;
- int k=0;
- for(int i=1;i<=wysokosc;i++)
- {
- for(int j=0;j<i;j++)
- {
- cin>> wiek[i][j];
- wiekk[k]=wiek[i][j];
- k++;
- }
- }
- // cout<<"Wyswietl"<<endl;
- sort(wiekk,wiekk+k);
- /* for(int i=0;i<k;i++)
- {
- cout<<wiekk[i]<<endl;
- }
- for(int i=1;i<=wysokosc;i++)
- {
- for(int j=0;j<i;j++)
- cout<< wiek[i][j]<<"\t";
- cout<<endl;
- }*/
- for(int m=0;m<k;m++)
- {
- for(int i=1;i<=wysokosc;i++)
- {
- for(int j=0;j<i;j++)
- {
- if(wiekk[m]==wiek[i][j])
- {
- if((i-j)*(j+1)<=butelki)
- {
- cout<<wiekk[m]<<endl;
- goto wypierdalaj;
- }
- }
- }
- }
- }
- wypierdalaj:
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement