NOIP2010 Universal Group Three games-silvern

Source: Internet
Author: User

1#include <iostream>2#include <cstdio>3#include <algorithm>4#include <cmath>5 using namespacestd;6 intd[510][510];7 intN;8 intFst,snd,ans;9 intMain () {Tenscanf"%d",&n); One     inti,j,x; A      for(i=1; i<n;i++) -        for(j=i+1; j<=n;j++) -       { thescanf"%d",&d[i][j]); -d[j][i]=D[i][j]; -       } -      for(i=1; i<=n;i++){ +fst=0; snd=0; -        for(j=1; j<=n;j++){ +           if(d[i][j]>FST) { ASnd=FST; atfst=D[i][j]; -           } -         Else if(D[I][J]&GT;SND) snd=D[i][j]; -         if(Snd>ans) ans=snd; -       } -     } inprintf"1\n%d", ans); -     return 0; to}

The contents of the topic are not released

Because the computer will always remove the largest combination, so the player can only get the second largest combination of values

Then find the second largest combination.

NOIP2010 Universal Group Three games-silvern

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.