随笔分类 -  搜索

摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4069Problem DescriptionToday we play a squigglysudoku, The objective is to fill a 9*9 grid with digits ... 阅读全文
posted @ 2014-08-31 00:00 Oyking 阅读(270) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4900Problem DescriptionThere is an old country and the king fell in love with a devil. The devil always... 阅读全文
posted @ 2014-08-02 22:44 Oyking 阅读(468) 评论(0) 推荐(0)
摘要:DescriptionGive a tree with n vertices,each edge has a length(positive integer less than 1001).Define dist(u,v)=The min distance between node u and v.Give an integer k,for every pair (u,v) of vertices is called valid if and only if dist(u,v) not exceed k.Write a program that will count how many pair 阅读全文
posted @ 2013-11-05 20:00 Oyking 阅读(216) 评论(0) 推荐(0)
摘要:DescriptionConsider a tree T with N (1 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int MAXN = 20010; 8 const int MAXE = 40010; 9 const int INF = 0x7fff7fff;10 11 int head[MAXN], size[MAXN], maxSize[MAXN], f[MAXN];12 int to[MAXE], next[MAXE];13 int n, ecnt;14 15 void init()... 阅读全文
posted @ 2013-11-05 16:49 Oyking 阅读(365) 评论(0) 推荐(0)
摘要:Simon loves neatness. So before he goes to bed, Simon wants to complete all chores in the house.Simon's house looks like a rectangular table consisting ofnrows andncolumns from above. All rows of the table are numbered from1tonfrom top to bottom. All columns of the table are numbered from1tonfro 阅读全文
posted @ 2013-11-03 15:55 Oyking 阅读(300) 评论(0) 推荐(0)
摘要:Problem DescriptionJapanese Mahjong is a four-player game. The game needs four people to sit around a desk and play with a set of Mahjong tiles. A set of Mahjong tiles contains four copies of the tiles described next:One to nine Man, which we use 1m to 9m to represent;One to nine Sou, which we use 1 阅读全文
posted @ 2013-10-03 17:41 Oyking 阅读(319) 评论(0) 推荐(0)
摘要:小城和小华都是热爱数学的好学生,最近,他们不约而同地迷上了数独游戏,好胜的他们想用数独来一比高低。但普通的数独对他们来说都过于简单了,于是他们向Z 博士请教,Z 博士拿出了他最近发明的“靶形数独”,作为这两个孩子比试的题目。靶形数独的方格同普通数独一样,在 9 格宽×9 格高的大九宫格中有9 个3 格宽×3 格高的小九宫格(用粗黑色线隔开的)。在这个大九宫格中,有一些数字是已知的,根据这些数字,利用逻辑推理,在其他的空格上填入1 到9 的数字。每个数字在每个小九宫格内不能重复出现,每个数字在每行、每列也不能重复出现。但靶形数独有一点和普通数独不同,即每一个方格都有一个分值, 阅读全文
posted @ 2013-09-18 23:09 Oyking 阅读(453) 评论(0) 推荐(0)
摘要:DescriptionN children are living in a tree with exactly N nodes, on each node there lies either a boy or a girl. A girl is said to be protected, if th... 阅读全文
posted @ 2013-09-18 14:41 Oyking 阅读(728) 评论(0) 推荐(0)
摘要:DescriptionA Sudoku grid is a 16x16 grid of cells grouped in sixteen 4x4 squares, where some cells are filled with letters from A to P (the first 16 capital letters of the English alphabet), as shown in figure 1a. The game is to fill all the empty grid cells with letters from A to P such that each l 阅读全文
posted @ 2013-09-17 15:18 Oyking 阅读(492) 评论(2) 推荐(0)
摘要:DescriptionAxel and Birgit like to play a card game in which they build a house of cards, gaining (or losing) credits as they add cards to the house. ... 阅读全文
posted @ 2013-09-13 22:34 Oyking 阅读(545) 评论(0) 推荐(0)
摘要:DescriptionA new Semester is coming and students are troubling for selecting courses. Students select their course on the web course system. There are n courses, the ith course is available during the time interval (Ai,Bi). That means, if you want to select the ith course, you must select it after t 阅读全文
posted @ 2013-09-05 23:32 Oyking 阅读(379) 评论(0) 推荐(0)
摘要:DescriptionMath Olympiad is called “Aoshu” in China. Aoshu is very popular in elementary schools. Nowadays, Aoshu is getting more and more difficult. Here is a classic Aoshu problem: ABBDE __ ABCCC = BDBDEIn the equation above, a letter stands for a digit(0 � 9), and different letters stands for dif 阅读全文
posted @ 2013-09-05 23:00 Oyking 阅读(287) 评论(0) 推荐(0)
摘要:A and B are playing a shooting game on a battlefield consisting of square-shaped unit blocks. The blocks are occupying some consecutive columns, and the perimeter of the figure equals the perimeter of its minimal bounding box. The figure (a) below is a valid battlefield, but (b) and (c) are not, bec 阅读全文
posted @ 2013-08-23 23:06 Oyking 阅读(411) 评论(0) 推荐(0)
摘要:You live in a small town withRbidirectional roads connectingCcrossings and you want to go from crossing 1 to crossingCas soon as possible. You can visit other crossings before arriving at crossingC, but it's not mandatory.You have exactly one chance to ask your friend to repair exactly one exist 阅读全文
posted @ 2013-08-23 22:45 Oyking 阅读(769) 评论(0) 推荐(0)
摘要:You have a maze with obstacles and non-zero digits in it:You can start from any square, walk in the maze, and finally stop at some square. Each step, you may only walk into one of thefour neighbouring squares (up, down, left, right)and you cannot walk into obstacles or walk into a square more than o 阅读全文
posted @ 2013-08-23 22:17 Oyking 阅读(1461) 评论(0) 推荐(0)
摘要:Problem DescriptionConsider a Depth-First-Search(DFS) spanning tree T of a undirected connected graph G, we define a T-Simple Circle as a path v1, v2, ..., vk(v1= vk) in G that contains at most one edge which not belongs to the DFS spanning tree T.Given a graph G, we process DFS on G starting from v 阅读全文
posted @ 2013-08-22 19:50 Oyking 阅读(693) 评论(0) 推荐(0)
摘要:Problem Description Let f(x) = anxn+...+ a1x +a0, in which ai(0 = 3, otherwise abs(ai) 2 #include 3 #include 4 #include 5 using namespace std; 6 typedef long long LL; 7 8 const int MAXN = 8; 9 10 int T, deg;11 LL phi;12 LL a[MAXN];13 14 LL f(LL x, LL m) {15 LL ret = 0, xx = 1;16 for(in... 阅读全文
posted @ 2013-08-22 14:25 Oyking 阅读(468) 评论(5) 推荐(0)
摘要:DescriptionFacer is addicted to a game called "Tidy is learning to swim". But he finds it too easy. So he develops a new game called "Facer is learning to swim" which is more difficult and more interesting.In the new game, a robot named "Facer" is swimming in a pool. Th 阅读全文
posted @ 2013-08-19 20:09 Oyking 阅读(540) 评论(0) 推荐(0)
摘要:DescriptionStudents often have problems taking up seats. When two students want the same seat, a quarrel will probably begin.It will have very bad effect when such subjects occur on the BBS. So, we urgently need a seat-taking-up rule. After several days of argument, the rule finally comes out: As sh 阅读全文
posted @ 2013-08-16 17:14 Oyking 阅读(350) 评论(0) 推荐(0)
摘要:DescriptionOn the evening of 3 August 1492, Christopher Columbus departed from Palos de la Frontera with a few ships, starting a serious of voyages of... 阅读全文
posted @ 2013-08-16 16:18 Oyking 阅读(431) 评论(0) 推荐(0)