Bestcoder Round #35

Source: Internet
Author: User

A

Test instructions: Give n black Ball, M white ball, take 1 balls at a time, take n+m times, will generate a random 01 strings s,

If the first time I take out is a black ball, then s[i]=1, if it is white, then s[i]=0, ask 01 string in S in the number of expected

Presumably this is because after taking out a 01 string, the other two 01 strings, three 01 strings, four 01 strings are included in the case, so you just need to figure out a 01 string of how many cases can be

1#include <iostream>2#include <cstdio>3#include <cstring>4#include <cmath>5#include <stack>6#include <vector>7#include <map>8#include <Set>9#include <queue>Ten#include <algorithm> One #definemod=1e9+7; A using namespacestd; -  -typedefLong LongLL; the  -LL Jiecheng (inta) { -LL ans=1; -      for(intI=1; i<=a;i++) +ans*=i; -     returnans; + } A  at ll gcd (ll A,ll b) { -     returnb==0? A:GCD (b,a%b); - } -  - intMain () { -     intn,m,i; in      while(SCANF ("%d%d", &n,&m)! =EOF) { -         intA= (nm); to         intb=n+m; +         intxx=gcd (A, b); -a=a/xx; theb=b/xx; *printf"%d/%d\n", A, b); $}return 0;Panax Notoginseng}
View Code

In the beginning, with Next_permutation, 9 12, you can't run.

Only later did I know to state compression = =

B

A direction-free graph is given, which requires that the maximum topological ordering of the dictionary order be obtained after the deletion of the K-bar.

not = = See the puzzle to use the segment tree = =

Digging pits

Bestcoder Round #35

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.