2016 Dalian Online game

Source: Internet
Author: User
Tags cmath

2016 Dalian Online game

Summary: Weak explosion, a problem has not been made

1006 Football Games HDU 5873

1, test instructions: Team game, Win +2, lose +0, Ping +1. Give the final score to see if it fits.

2, Summary: It seems that there is a theorem to determine this sequence,

S?1?? +s?2?? +...+s?i?? ≥i (i−1), for all 1≤i≤n−1
S?1?? +s?2?? +...+s?n?? =n (n−1), for I==n

#include <iostream>#include<cstring>#include<cmath>#include<queue>#include<algorithm>#include<cstdio>#defineMax (A, b) a>b?a:b#defineF (I,A,B) for (int i=a;i<=b;i++)#defineINF 0x3f3f3f3f#defineLL Long Longusing namespacestd;Const intn=21000;intMain () {intT,n; intA[n];  while(~SCANF ("%d",&t)) { while(t--) {scanf ("%d",&N); F (i,1, N) scanf ("%d",&A[i]); Sort (a+1, A +1+N); LL sum=0; intJ;  for(j=1; j<=n;j++) {sum+=A[j]; if(sum< (LL) j* (J-1))                     Break; }            if(sum!= (LL) n (n1)|| j<=N) puts ("F"); ElsePuts"T"); }    }    return 0;}
View Code

1007 Friends and Enemies HDU 5874

1, test instructions: Dwarf Island, every two people are either friends or enemies. As friends, the two shall have at least one stone in the same color, and the enemy shall not have the same color as any stone.

2, Summary: not understand

(1) Oeis on a formula

(2) conversion to the maximum binary chart, the graph of n points requires as many edges as possible, and there is no ternary ring. This edge number is the lower bound of the MM, for an nn node is not a three-ring graph, the largest number of sides is a complete two-part diagram.

#include <iostream>#include<cstring>#include<cmath>#include<queue>#include<algorithm>#include<cstdio>#defineMax (A, b) a>b?a:b#defineF (I,A,B) for (int i=a;i<=b;i++)#defineINF 0x3f3f3f3f#defineLL Long Longusing namespacestd;Const intn=10000;intMain () {LL n,m;  while(SCANF ("%lld%lld", &n,&m)! =EOF) {        /*LL sum= (2*n*n+ (n&1?-1:1))/8;        Ieos on the formula if (Sum>m) puts ("F");        Else puts ("T"); */                if(m>=n*n/4) puts ("T");//Convert to maximum binary chart        ElsePuts"F"); }    return 0;}
View Code

2016 Dalian Online game

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.