T049 Death Beach

Source: Internet
Author: User

#include <stdio.h>voidSelectionsort (intA[],intN) to facilitate comparison, first sort {intI, J, K, T;  for(i=0; i<n-1; i++) {k=i;  for(j=i;j<n;j++)        {            if(a[j]<A[k]) k=J; } t=A[i]; A[i]=A[k]; A[K]=T; }}intMain () {intN, M, I, J, K, sum=0; inta[Ten], b[Ten]; scanf ("%d%d", &n, &m); if(n>m) {printf ("NULL"); If you can't kill your tentacles, GG}Else    {         for(i=0; i<n;i++) {scanf ("%d", &A[i]); }         for(j=0; j<m;j++) {scanf ("%d", &B[j]);        } selectionsearch (A,n);        Selectionsearch (B,M);  for(i=0; i<n;i++)        {             for(j=0; j<m;j++) {k=0; if(b[j]>=A[i]) {k=k+1; Sum+=B[j]; }                if(k!=0)//Initialize the compared and calculated elements to 0, guaranteeing no repetition of the operation {B[j]=0; }                if(k==0)Continue; Else  Break; }} printf ("%d\n", sum); }    return 0;}

T049 Death Beach

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.