匹配的一些概念:完美匹配、完備匹配、首選交錯軌可增廣軌匈牙利演算法原理:從當前匹配M出發,檢查每個未蓋點,然後從它出發尋找可增廣路,找到可增廣路,沿著增廣路擴充,直到找不到這樣的路停止。 JOJ 2730 題意:http://blog.csdn.net/jxy859/article/details/6747413鄰接陣#include <cstdio>#include <cstring>const int N=105;const int M=105;bool map[N]
ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE3s8192K1756336StandardCalculate for large values of B, P, and M using an efficient algorithm. (That's right, this problem has a time dependency !!!.) InputThree integer values (in the order B, P, M)
好吧。。我的第二題現在還是掛著,算了,就把第二題無視掉吧,貼一下ACD的解題思路。 A 水題,不說太多,直接類比就可以了,用a數組表示指定位置的d,為了防止出現負數,把x都加了20000,讀取了一個x和一個d,判斷a[x+d]是否是-d即可,如果是,就說明找到了一對。 My Code:#include <cstdio>#include <cstring>#include <cstdlib>using namespace std;int
給n個顏色,m個點的環,求有多少種通過旋轉,翻轉變化後不同的染色方法利用polya定理用大數模數,一直WA,改成數組預先處理就AC了。。。#include <cstdio>const long long mm=1000000007;int I=0;long long bigmod(long long b,long long p,long long m){ long long k; for(k=1,b=b%m; p ; p/=2,b=b*b%m) if(p%2)
假設有一種情況共線最多,那麼一定可以通過平移和轉動那條直線,使直線通過其中的至少2個多變形的頂點,而不改變是否穿過多邊形的性質,所以只需枚舉這樣的多邊形就可以了。n為1 和2的時候直接輸出n就好了,一開始看錯了n的範圍,沒考慮1的情況,WA了好多次。#include <cstdio>struct Node{ int x,y;}node[11][11];struct Line{ int A , B , C ;}tmp;int cnt[11];int n;bool
文章目錄 InputOutputSample InputSample Output ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE3s8192K17842StandardN boxes are lined up in a sequence (1 <= N <= 20). You have A red balls and B blue balls (0 <= A <
文章目錄 InputOutputSample InputSample Output ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE3s8192K27751StandardA lattice point is an ordered pair (x, y) where x and y are both integers. Given the coordinates of the