锘??xml version="1.0" encoding="utf-8" standalone="yes"?>中文字幕久久久久人妻,香港aa三级久久三级,99精品久久精品一区二区http://m.shnenglu.com/syhd142/archive/2011/08/02/121289.html#152303songzhongpingsongzhongpingTue, 02 Aug 2011 10:57:00 GMThttp://m.shnenglu.com/syhd142/archive/2011/08/02/121289.html#152303#include <stdio.h>
#include <iostream>


using namespace std;
int f[60005];
#define MAX(a,b) a>b?a:b
void Complete(int cost, int weight, int m)
{
for(int i = cost; i <= m; i++)
f[i] = MAX(f[i], f[i - cost] + weight);
}
void Zero_One(int cost, int weight, int m)
{
for(int i = m; i >= cost; i--)
f[i] = MAX(f[i], f[i - cost] + weight);
}

int main(int argc, char *argv[])
{
int a[7],n,i,j,sum,t=0;
while(1)
{
sum=0;

for(i=1;i<7;i++)
{
scanf("%d",a+i);
sum+=a[i]*i;
}
if(!sum) break;
if(sum&1)
{ printf("Collection #%d:\n",++t);
puts("Can't be divided.\n");
continue;
}
sum >>= 1;
memset(f,0,sizeof(f));
for(i=1;i<7;i++)
{
if(a[i]*i>=sum)
{
Complete(i,i,sum);
}
else if(a[i]>0)
{
int k=1;
while(k<a[i])
{
Zero_One(k*i,k*i,sum) ;
a[i]-=k;
k <<= 1;
}
for(j=sum;j>=i*a[i];j--)
{
Zero_One(a[i]*i,a[i]*i,sum);
}
}
}

if(f[sum]==sum)
{
printf("Collection #%d:\n",++t);
puts("Can be divided.\n");

}
else
{printf("Collection #%d:\n",++t);
puts("Can't be divided.\n");

}

}
// system("PAUSE");
return EXIT_SUCCESS;
}
//榪欐槸鎴戠殑浠g爜涓轟粈涔堟繪槸瓚呮椂鍛紵姹傝В閲娿傘?img src ="http://m.shnenglu.com/syhd142/aggbug/152303.html" width = "1" height = "1" />

songzhongping 2011-08-02 18:57 鍙戣〃璇勮
]]>
re: HDU 2896 鐥呮瘨渚佃http://m.shnenglu.com/syhd142/archive/2011/05/14/138223.html#146361灝忓凹浜?0灝忓凹浜?0Sat, 14 May 2011 05:04:00 GMThttp://m.shnenglu.com/syhd142/archive/2011/05/14/138223.html#146361#include <string.h>
#include <math.h>
#include <vector>
#include <iostream>
#include <set>
#include <algorithm>
#include <queue>
using namespace std;

#define kind 129
#define M 10010

struct node {
node *fail;
node *next[kind];
int id;
node() { //鏋勯犲嚱鏁?
fail = NULL;
id = 0;
memset(next, NULL, sizeof(next));
}
};

char ch[M]; //閿洏杈撳叆鐨勪覆
queue<node *> q;
set <int> g;
int n, m;

void insert(node *root, char *str, int num) {
node *p = root;
int i = 0, index;
while(str[i]) {
index = str[i] - 'a';
if(p->next[index] == NULL) {
p->next[index] = new node();
}
p = p->next[index];
i++;
}
p->id = num;
}

void AC (node *&root) { ///root -> fail = NULL;
q.push(root);
while(!q.empty()) {
node *p = NULL;
node *t = q.front();
q.pop();
for(int i = 0; i < kind; i++) {

if(t->next[i]) {

p = t->fail;

while(p) {
if(p->next[i]) {
t->next[i]->fail = p->next[i];
break;
}
p = p->fail;
}
if(!p) t->next[i]->fail = NULL;
q.push(t->next[i]);
}
}
}
}

bool query(node *&root, char *str, int ca) {
g.clear();
int i = 0, t, flag = 0;
node *p = root, *tmp;
while(str[i]) {
t = str[i] - 'a';
while(!p->next[t] && p != root) { p = p->fail; }
///*****************************///
p = p->next[t];
///******************************///
if(!p) p = root;
tmp = p;
while(tmp != root && tmp->id) {
flag = 1;
g.insert(tmp->id);
tmp = tmp->fail;
}
i++;
}
if(!flag) return false;
printf("web %d:", ca);
for(set<int>::iterator it = g.begin(); it != g.end(); it++) {
cout << ' ' << *it;
}
cout << endl;
return true;
}

int main() {
int total;
while(~scanf("%d", &n)) {
node *root = new node();
total = 0;
for(int i = 0; i < n; i++) {
scanf("%s", ch);
insert(root, ch, i+1);
}
AC(root);
cin >> n;
for(int i = 0; i < n; i++) {
cin >> ch;
if(query(root, ch, i+1)); total++;
}
printf("total: %d\n", total);
}
return 0;
}








甯繖鐪嬬湅鍚э紒妤間富錛岀収浣犵殑鍐欑殑錛屼絾鏄繕鏄笉琛岋紝杈撳叆閮戒笉琛?img src ="http://m.shnenglu.com/syhd142/aggbug/146361.html" width = "1" height = "1" />

灝忓凹浜?0 2011-05-14 13:04 鍙戣〃璇勮
]]>
re: UVA 624 CDhttp://m.shnenglu.com/syhd142/archive/2011/03/31/118968.html#143110FuckerFuckerThu, 31 Mar 2011 06:32:00 GMThttp://m.shnenglu.com/syhd142/archive/2011/03/31/118968.html#143110棰濓紝鏈夌偣閬ヨ繙浜嗭紝閮藉繕璁頒簡銆?img src ="http://m.shnenglu.com/syhd142/aggbug/143110.html" width = "1" height = "1" />

Fucker 2011-03-31 14:32 鍙戣〃璇勮
]]>
re: UVA 624 CDhttp://m.shnenglu.com/syhd142/archive/2011/03/31/118968.html#143105alienalienThu, 31 Mar 2011 05:57:00 GMThttp://m.shnenglu.com/syhd142/archive/2011/03/31/118968.html#14310545 8 4 10 44 43 12 9 8 2
榪欑粍鎴戠敤浣犵殑紼嬪簭璁$畻鍑烘潵鐨勬槸43 2 sum:45.
搴旇鏄? 10 12 9 8 2 sum:45
涓轟粈涔堝彲浠ヨ繖鏍瘋褰曡礬寰勶紵

alien 2011-03-31 13:57 鍙戣〃璇勮
]]>
re: UVA 11594 All Pairs Maximum Flowhttp://m.shnenglu.com/syhd142/archive/2011/02/12/119887.html#139929ZiwenZiwenSat, 12 Feb 2011 03:29:00 GMThttp://m.shnenglu.com/syhd142/archive/2011/02/12/119887.html#139929THX
Very Simple Methods for All Pairs Network Flow Analysis
caocao9926@163.com

Ziwen 2011-02-12 11:29 鍙戣〃璇勮
]]>
re: UVA 10003 Cutting Stickshttp://m.shnenglu.com/syhd142/archive/2010/11/17/118133.html#133879jerrymu1234jerrymu1234Wed, 17 Nov 2010 06:01:00 GMThttp://m.shnenglu.com/syhd142/archive/2010/11/17/118133.html#133879
濡備綍鍦ㄦ眰minimum cost鍊肩殑鍚屾椂錛?
璁板綍鎵cut鐨勭偣鐨勬搴??琚洶鎵板ソ涔呫傘傘傘傘?

姣斿input:
10 (鏈ㄦ闀?
3 錛堝垏3嬈★級
2 4 7 錛堝湪2錛?錛?澶勫垏錛?
Output:
The minimum cost is 20.
The optimal cutting sequence: 4,2,7

jerrymu1234 2010-11-17 14:01 鍙戣〃璇勮
]]>
re: UVA 10819 Trouble of 13-Dotshttp://m.shnenglu.com/syhd142/archive/2010/11/14/118985.html#133560FuckerFuckerSat, 13 Nov 2010 16:26:00 GMThttp://m.shnenglu.com/syhd142/archive/2010/11/14/118985.html#133560鑳屽寘涔濊閲岄潰璨屼技鏈夎銆?img src ="http://m.shnenglu.com/syhd142/aggbug/133560.html" width = "1" height = "1" />

Fucker 2010-11-14 00:26 鍙戣〃璇勮
]]>
99久久久精品| 久久伊人五月丁香狠狠色| 国产激情久久久久影院小草| 伊人色综合久久天天人手人婷| 青青草原综合久久大伊人导航| 久久激情五月丁香伊人| 久久综合久久性久99毛片| 亚洲婷婷国产精品电影人久久 | 久久se精品一区二区影院| 久久精品国产黑森林| 波多野结衣久久| 久久成人国产精品二三区| 久久精品夜色噜噜亚洲A∨ | 久久免费视频网站| 国产精品免费久久久久久久久 | 久久99热精品| 久久久久久午夜精品| 亚洲AV无码1区2区久久| 久久九九全国免费| 久久国语露脸国产精品电影| 久久精品嫩草影院| 狠狠精品久久久无码中文字幕| 久久福利青草精品资源站| 97香蕉久久夜色精品国产 | 久久久国产99久久国产一| 国产一久久香蕉国产线看观看| 久久久久久国产精品美女| …久久精品99久久香蕉国产| 亚洲伊人久久成综合人影院 | 久久精品99久久香蕉国产色戒 | 国产精自产拍久久久久久蜜| 亚洲精品乱码久久久久久蜜桃不卡| 日本久久久精品中文字幕| 日产精品久久久一区二区| 人妻精品久久久久中文字幕| 久久精品免费一区二区三区| 国产精品久久久亚洲| 久久91亚洲人成电影网站| 国产亚洲美女精品久久久2020| 91久久成人免费| 999久久久国产精品|