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