daily pastebin goal
47%
SHARE
TWEET

UVA-11559

a guest Mar 13th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int i, n, b, j, k=0, h, w, p, a, max, c, money[202], arr[20], bed[201];
  5.     while(scanf("%d %d %d %d", &n, &b, &h, &w)==4){
  6.     for(i=0; i<h; i++){
  7.         scanf("%d", &arr[i]);
  8.         for(j=0; j<n; j++){
  9.             scanf("%d", &bed[j]);
  10.             if(bed[j]==0)
  11.                 c=1;
  12.         }
  13.         if(c!=1){
  14.             money[k]=n*arr[i];
  15.             k++;
  16.         }
  17.         c=0;
  18.     }
  19.     if(k!=0){
  20.         max=0;
  21.         for(i=0; i<k; i++){
  22.             if(money[i]>max)
  23.                 max=money[i];
  24.         }
  25.     }
  26.     if(max>b)
  27.         printf("stay home\n");
  28.     else
  29.         printf("%d\n", max);
  30.     }
  31.     return 0;
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top