In the math class, the evil teacher gave you one unprecedented problem! Here f(n) is the n-th fibonacci number (n >= 0)! Where f(0) = f(1) = 1 and for any n > 1, f(n) = f(n - 1) + f(n - 2). For example, f(2) = 2, f(3) = 3, f(4) = 5 ... The teacher u
ZOJ Problem Set - 2676 Network Wars Time Limit: 5 Seconds Memory Limit: 32768 KB Special Judge Network of Byteland consists of n servers, connected by m optical cables. Each cable connects two servers and can transmit data in both d
Smallest Minimum Cut Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2281 Accepted Submission(s): 913 Problem Description Consider a network G=(V,E) with source s and sink t. An s-t cut is a
题目信息: 给出一些物品的价值和个数.分成两份,是这两份的价值相差最小(DP方法) http://acm.hdu.edu.cn/showproblem.php? pid=1171 AC代码: /** *0-1背包问题 *使得总背包的一半空间装尽可能多的价值 */ #include<iostream> #include<cstring> using namespace std; int dp[250000]; int v[5500]; int main() { int
clear all; close all; clc img=imread('lena.bmp'); figure; imshow(uint8(img)); [m n]=size(img); img_max=0; img_min=256; img_avg=0; for i=1:1:m for j=1:1:n if img(i, j)<img_min img_min=img(i,j); end if img(i, j)>img_max img_max=img(i,j); end img_avg=i
今天申请了博客园账号,在下班后阅览博客时发现了一个关于百度面试题探讨的博客(其实是个很基础的问题),此博客url为:http://www.blogjava.net/nokiaguy/archive/2013/01/30/394920.html 其中下面有人评论为: 有序列表查找显然二分啊,博主貌似对java的arrays和collections不是很熟. private static int getMinAbsoluteValue(final int[] source) { int index
Catenyms Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8756 Accepted: 2306 Description A catenym is a pair of words separated by a period such that the last letter of the first word is the same as the last letter of the second. For e