HDU 4344-mark The rope-factorization of large numbers of elements

Source: Internet
Author: User

Note that there is only one factor in the case.

1#include <cstdio>2#include <algorithm>3#include <cstring>4 5 using namespacestd;6 7typedefLong Longll;8 Const intINF =0x3f3f3f3f;9 Const intMAXN = 4e3+Ten;Ten structCake One { A     intw,l; - cake () {} -     BOOL operator< (ConstCake &b)Const the     { -         returnL >B.L; -     } - }CK[MAXN]; +  - intN,LEN[MAXN]; +  A intMain () at { -scanf"%d",&N); -  -      for(intI=0; i<n;i++) -     { -scanf"%d%d",&ck[i].w,&ck[i].l); in         if(Ck[i].w >ck[i].l) Swap (CK[I].W,CK[I].L); -     } to  +Sort (ck,ck+N); -  the     intm; *     intAnsw,ansl; $ll ans =-INF;Panax Notoginseng  -      for(intI=0; i<n;i++) the     { +m =0; A          for(intj=0; j<n;j++) the         { +             if(CK[J].W >=CK[I].W) -             { $len[m++] =CK[J].L; $             } -         } -          for(intj=0; j<m;j++) the         { -ll res = (ll) ck[i].w*len[j]* (j+1);Wuyi             if(Res >ans) the             { -Ans =Res; WuANSW =CK[I].W; -Ansl =Len[j]; About             } $         } -     } -printf"%i64d\n%d%d\n", ANS,ANSW,ANSL); -  A}

HDU 4344-mark The rope-factorization of large numbers of elements

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.