hdu1102 :題意是在一個無向圖中有一些邊已經建好求最小產生樹,思路很簡單就是將已建的道路權值變為0即可。我用的是kruskal求MSTimport java.util.Arrays;import java.util.Scanner;public class Main {static int max=10010;static int parent[]=new int[max];static line data[];static int Nodenum;static void
J - Positive Negative SignTime Limit:2000MS Memory Limit:32768KB 64bit IO Format:unknownDescriptionGiven two integers: n and m and n is divisible by 2m, you have to write down the first n natural numbers in the following form. At first take
今天系統的做了一下有關最小產生樹的題目,都挺水的,水水更健康嘛1.hdu1233,中文題目,不再贅述了,很裸的MSTimport java.util.Arrays;import java.util.Scanner;public class hdu1233 {static int roadnum;static int max=10010;static int parent[]=new int[max];static road ro[];static void init(){for(int i=0;
DFS的兩種實現:import java.util.Scanner;public class hdu1312DFS {static char map[][]=new char[22][22];static int x,y;static int inc[][]={{1,0},{0,1},{-1,0},{0,-1}};static int ans;static void init(){Scanner in=new
poj1751:題意:已知某些邊建好的情況下求最小產生樹中其他需要建的邊,輸出其起點和終點這道題目是spj,對輸出的順序沒有要求我用java寫一直MLE,百思不得其解,然後又用C++寫了一遍就AC了。這次終於知道了在結構體內寫比較函數要比在外面寫cmp快的多第二次在外面寫的cmp直接卡時間超低空飄過,呵呵不多說了,看代碼吧//============================================================================// Name
A. Plate Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou've got a rectangular table with length a and width b and the infinite number of plates of radius r. Two players play the following
USACO/contactContact 聯絡IOI'98奶牛們開始對用射電望遠鏡掃描牧場外的宇宙感興趣。最近,他們注意到了一種非常奇怪的脈衝調製微波從星系的中央發射出來。他們希望知道電波是否是被某些地外生命發射出來的,還是僅僅是普通的的星星發出的。描述協助奶牛們用一個能夠分析他們在檔案中記下的記錄的工具來找到真相。他們在尋找長度在A到B之間(含)在每天的資料檔案中重複得最多的位元序列 (1 <= A <= B <=
Shaping RegionsN opaque rectangles (1 <= N <= 1000) of various colors are placed on a white sheet of paper whose size is A wide by B long. The rectangles are put with their sides parallel to the sheet's borders. All rectangles fall within the