Advertisement
otot957

Untitled

Aug 12th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #include<array>
  3. #include <bits/stdc++.h>
  4. #include<string>
  5. using namespace std;
  6. int main ()
  7.  
  8.  
  9.  
  10. {
  11.     int npar,bug,weeks,h,hbug,minamount=100000;
  12.     bool available=false;
  13.  
  14.     while(scanf("%d %d %d %d\n", &npar, &bug, &h, &weeks)!=EOF){
  15.         int aweeks;
  16.         minamount=10000000;
  17.         while(h--){
  18.             cin>>hbug;
  19.            
  20.                 for(int i=0;i<weeks;i++){
  21.                     cin>>aweeks;
  22.                     if(aweeks>=npar){
  23.                         available=true;
  24.                         minamount=min(minamount,npar*hbug);
  25.                         string s;
  26.                     getline(cin, s);
  27.                         break;
  28.                    
  29.                 }
  30.             }
  31.         }
  32.         if( minamount!=10000000 && minamount<=bug)
  33.             cout<<minamount<<endl;
  34.         else cout<<"stay home"<<endl;
  35.     }
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement