2017百度之星初賽(B) 1001Chess

2021-08-06 04:03:57 字數 611 閱讀 3250

hdu--6114

題意:n行m列的矩陣,裡面盡可能的放最多的車,並且使得,車不相互攻擊(不同在一行或一列),同時要滿足,行數大的,列數也要大。

思路:由於盡可能放最多的車。假設n大於m那麼最多可以放m輛車,那麼就從n中選m列出來放好車就行。所以答案是c(n,m);

主要是儲存一波c(n,m)的打表模板。

#include #include #include #include #include #define ll long long

#define siz 100005

#include #include using namespace std;

int n,m;

int c[1005][1005];

int xp[1005][1005];

const int mod = 1e9+7;

void get_c(int maxn)

}int main()

{ int t;

//getgp();

get_c(1000);

scanf("%d",&t);

while(t--){

scanf("%d%d",&n,&m);

if(n

百度之星 初賽B

a 傳送門 點我 求聯通塊個數,對於簡單圖而言,就是c v e,其中c就是聯通塊個數,v是頂點數,e是邊數 include include include include using namespace std const int max n 2e5 10 int n,m,k vectorg max...

2017百度之星初賽B場總結

a場因為不可抗力因素 沒能參加,b場還好算是磕磕碰碰地吃著低保過去了,真的菜呀 可以說還是比較一目了然的簽到題,由於這些點的橫縱座標都必須嚴格遞增,那麼我們最多能取到的點就是mi n n,m 個 方案數就相當於是在 max n,m 中選 min n,m 個的方案數,那麼答案就是c max n,m m...

百度之星2017初賽題解(A)

t1 簡單數論,問滿足 a0 a1 b an b n a0 a1 an mod p 的p的個數 即滿足p b 1 a1 b 2 1 a2 b 3 1 a3 即p b 1的p的個數 sqrt b 1 暴力列舉b 1約數即可 t2 現在給若干個條件,xi xj或xi xj,要你將它們劃分成若干組,滿足每...