UVa 11559 - Event Planning

#include<stdio.h>
int main()
{
    long frnd,bud,hotel,week,amount,cost,p,i,j,room;
    while(scanf("%ld%ld%ld%ld",&frnd,&bud,&hotel,&week)==4)
    {
        cost=9999999;
        for(i=0; i<hotel; i++)
        {
            scanf("%ld",&amount);
            for(j=0; j<week; j++)
            {
                scanf("%ld",&room);
                p=0;
                if(room>=frnd)
                {
                    p=amount*frnd;
                    if(cost>p)
                        cost=p;
                }
            }
        }
        if(cost>bud)
            printf("stay home\n");
        else
            printf("%ld\n",cost);
    }
    return 0;
}
Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 মন্তব্য(গুলি):

একটি মন্তব্য পোস্ট করুন