Thứ Hai, 9 tháng 5, 2022

DICHOI C++

#include <bits/stdc++.h>
using namespace std;
int   sophong,n,q,h,d,p;
bool kt;

void giai()
{
    cin>>n>>q>>h>>d;
    int mi=q+1;
    for(int i=1;i<=h;i++)
       {
           cin>>p;
           kt=false;
           //kt so phong
           for(int j=1;j<=d;j++)
          {
            cin>>sophong;
              if(sophong>n) kt=true;
          }
           //kt du tien
           if(kt==true)
            if(p*n<mi) mi=p*n;//tien it I
       }
   //xuat kq
   if(mi<=q) cout<<mi;
   else  cout<<"stay home";
}
int main()
{
    freopen("dichoi.inp","r",stdin);
    freopen("dichoi.out","w",stdout);
    giai();
}

Không có nhận xét nào:

Đăng nhận xét

Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.