TC SRM 673 Div1

Source: Internet
Author: User

TC srm.673 300

Time Limit:20 Sec

Memory limit:256 MB

Topic Connection

Description

Give you n (n<=50) horse and n person, a horse and a person can form a cavalry, this cavalry's fighting power equals the combat effectiveness of the horse, ask you how many combinations of ways to meet the other cavalry's combat effectiveness is no more than the No. 0 cavalry.

Input

Output

Sample Input

Sample Output

HINT

Test instructions

Exercises

Probably on the violence enumeration which horse and the No. 0 match, the cavalry behind us according to the combat effectiveness from the big to the small after the order, for each cavalry two points (or violence) to find the maximum number of horses can be selected, and then can be a little bit to do it!

Code

#include <stdio.h>#include<string.h>#include<iostream>#include<algorithm>using namespacestd;Const intMoD = 1e9+7;BOOLcmpintAintb) {    returnA>b;}classbearcavalry{ Public:    intCountassignments (Vector <int> Warriors, Vector <int>horses) {Sort (Warriors.begin ()+1, Warriors.end (), CMP);        Sort (Horses.begin (), Horses.end ()); Long LongAns =0;  for(intI=0; I) {sort (Horses.begin (), Horses.end ()); intp = warriors[0]*Horses[i]; intK =Horses[i]; Horses.erase (Horses.begin ()+i); Long LongAns2 =1; intFlag =0;  for(intj=1; J<warriors.size (); j + +)            {                Long LongTMP =-1;  for(intt=0; T)                {                    if(warriors[j]*horses[t]>=p) Break; TMP=T; }                //cout<<i<< "" <<j<< "" <<tmp<<endl;TMP = tmp +2-J; //cout<<i<< "" <<j<< "" <<tmp<<endl;                if(tmp<=0) {flag=1;  Break; } ans2= (ANS2 * tmp)%MoD; }            if(flag==0) ans= (ans + ans2)%MoD;        Horses.push_back (k); }        returnans; }};intMain () {bearcavalry C; Vector<int>A; Vector<int>b; A.push_back (5); A.push_back (8); A.push_back (4); A.push_back (8); B.push_back ( +); B.push_back ( +); B.push_back ( -); B.push_back ( -); printf ("%d\n", C.countassignments (A, b));}

TC SRM 673 Div1

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.