Problem 57

3 comments on “Problem 57”


  • shushank

    #Python

    b,m,n=map(int,input().split(” “))
    l1=list(map(int,input().split(” “)))
    l2=list(map(int,input().split(” “)))
    l=[]
    for x in l1:
    for y in l2:
    if x+y0:
    print(max(l))
    else:
    print(“-1”)


  • Mihir

    ##Python Code

    def getmoneyspent(mny,key,drives):
    key = sorted(key,reverse=True)
    drives = sorted(drives,reverse=True)
    prices = []

    for i in key :
    for j in drives:
    sm = i + j
    if sm <= mny:
    prices.append(sm)
    rsl = sorted(prices,reverse=True)
    return(rsl[0])

    fsin = input()
    fsin = fsin.split(' ')
    fsin = list(map(int,fsin))
    mny = fsin[0]
    key = input()
    key = key.split(' ')
    key = list(map(int,key))
    drives = input()
    drives = drives.split(' ')
    drives = list(map(int,drives))

    print(getmoneyspent(mny,key,drives))

    #please reply if you better python code for this


  • Mohammed

    //code in C
    #include
    int main()

    {
    int b,usb[1000],key[1000],no=-1,i,j,n,m,result=0;

    scanf(“%d %d %d”,&b,&n,&m);

    for(i=0;i<n;i++)
    {
    scanf("%d",&key[i]);
    }

    for(j=0;j<m;j++)
    {

    scanf("%d",&usb[j]);

    }

    for(int i=0;i<n;i++)

    {

    for(int j=0;jno && result<=b)

    {

    no=result;

    }

    }

    }

    printf("%d",no);

    }