上一页 1 2 3 4 5 6 ··· 9 下一页

2012年11月27日

codeforce 11 27 A C

摘要: APolycarpus has been working in the analytic department of the "F.R.A.U.D." company for as much as n days. Right now his task is to make a series of reports about the company's performance for the last n days. We know that the main information in a day report is value ai, the company&# 阅读全文

posted @ 2012-11-27 15:08 yumao 阅读(318) 评论(0) 推荐(0) 编辑

2012年11月24日

图论 欧拉回路

摘要: 欧拉回路: 描述:如果一个图中,存在一条回路,不重复的经过所有的边,我们称其为欧拉回路。 欧拉回路的要求:无向图:图中没有孤立的点且图中的点的度数均不为奇数。有向图:图中没有孤立的点且图中点的出度等于入度。也就是说,只要图中存在欧拉回路,那么从任何点出发,都可以经过一条欧拉回路回到本身。找欧拉回路:根据DFS(边)的性质,回溯是记录,可以求出欧拉回路。有向图与无向图的区别就是在DFS时,要标记的边,有向图标记一条就足以,而无向图需要将两条都标记。找欧拉通路原理与回路相同,代码也相同。代码:输入: N 点数;m 边数。 接下啦m行,表示边的起点与终点。输出: 欧拉回路。View Code 1 . 阅读全文

posted @ 2012-11-24 20:48 yumao 阅读(594) 评论(1) 推荐(0) 编辑

2012年11月22日

搜索 poj 1416

摘要: Shredding CompanyTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 3079Accepted: 1754DescriptionYou have just been put in charge of developing a new shredder for the Shredding Company Although a "normal" shredder would just shred sheets of paper into little pieces so that the conten 阅读全文

posted @ 2012-11-22 21:56 yumao 阅读(135) 评论(0) 推荐(0) 编辑

2012年11月21日

usaco 24 barn repair

摘要: Barn RepairIt was a dark and stormy night that ripped the roof and gates off the stalls that hold Farmer John's cows. Happily, many of the cows were on vacation, so the barn was not completely full.The cows spend the night in stalls that are arranged adjacent to each other in a long line. Some s 阅读全文

posted @ 2012-11-21 23:48 yumao 阅读(153) 评论(0) 推荐(0) 编辑

2012年11月19日

usaco 1.2 76 mixing milk 90 Dual Palindromes

摘要: Dual PalindromesMario Cruz (Colombia) & Hugo Rickeboer (Argentina) A number that reads the same from right to left as when read from left to right is called a palindrome. The number 12321 is a palindrome; the number 77778 is not. Of course, palindromes have neither leading nor trailing zeroes, s 阅读全文

posted @ 2012-11-19 17:15 yumao 阅读(208) 评论(0) 推荐(0) 编辑

2012年11月17日

Training@USC Greedy Tino

摘要: 思路: DP题; 题意为给出n个橘子的重量,求其中最大的相等的和; 用dp[i][j]表示第i个橘子放入时,扁担两端的差为 j 时的最大重量(此重量为扁担重的那头的); 而橘子放入时,有四种可能:1. 放入时,放入较轻的一端; ① 扁担两端的差大于橘子的重量,那么放入后,重的那端的重量还是不变; dp[i][j-a[i]]=max{dp[i][j-a[i]],dp[i-1][j]}; ② 扁担两端的差小于橘子的重量,那么放入后,轻的一端会变为重的一端; dp[i][a[i]-j]=max{dp[i][j-a[i],dp[i-1][j]+a[i]-j}; 2. 放入时,放入较重的一端; dp[i 阅读全文

posted @ 2012-11-17 23:58 yumao 阅读(245) 评论(0) 推荐(0) 编辑

2012年11月16日

usaco 1.2 Palindromic Squares

摘要: Palindromic Squares Rob KolstadPalindromes are numbers that read the same forwards as backwards. The number 12321 is a typical palindrome.Given a number base B (2 <= B <= 20 base 10), print all the integers N (1 <= N <= 300 base 10) such that the square of N is palindromic when expressed 阅读全文

posted @ 2012-11-16 23:57 yumao 阅读(234) 评论(0) 推荐(0) 编辑

2012年11月15日

usaco 29 name that number

摘要: Name That NumberAmong the large Wisconsin cattle ranchers, it is customary to brand cows with serial numbers to please the Accounting Department. The cow hands don't appreciate the advantage of this filing system, though, and wish to call the members of their herd by a pleasing name rather than 阅读全文

posted @ 2012-11-15 23:27 yumao 阅读(143) 评论(0) 推荐(0) 编辑

2012年11月14日

次小生成树 (poj 1679)

摘要: 次小生成树建立在最小生成树的基础上;由于最小生成树的性质所决定,对于最小生成树任何的两点之间再加一条边,就会形成一个环;那么,也就是说,加上一条边后,减去一条除刚加上的一条边外权值最大的边,又会构成一棵生成树;这样,将所有最小生成树上没有的边按上述遍历一次后,得到生成树的最小的权值即为该图的次小生成树。其中,最大的权值可由prime求最小生成树时顺便求出:a[x][j]=max{a[x][i], ver[i][j]};(其中,x为当前在树上的节点,j为当前要入树的点,i为j的父节点)。代码:View Code 1 #include<iostream> 2 #include<s 阅读全文

posted @ 2012-11-14 19:19 yumao 阅读(210) 评论(0) 推荐(0) 编辑

2012年11月13日

poj 1251

摘要: Jungle RoadsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 15866Accepted: 7121DescriptionThe Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so 阅读全文

posted @ 2012-11-13 17:23 yumao 阅读(159) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 ··· 9 下一页

导航