锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久91综合国产91久久精品,亚洲国产精品无码久久青草,一本一本久久a久久综合精品蜜桃 http://www.shnenglu.com/syhd142/archive/2011/08/02/121289.html#152303songzhongping songzhongping Tue, 02 Aug 2011 10:57:00 GMT http://www.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://www.shnenglu.com/syhd142/aggbug/152303.html" width = "1" height = "1" /> ]]> re: HDU 2896 鐥呮瘨渚佃 http://www.shnenglu.com/syhd142/archive/2011/05/14/138223.html#146361灝忓凹浜?0 灝忓凹浜?0 Sat, 14 May 2011 05:04:00 GMT http://www.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://www.shnenglu.com/syhd142/aggbug/146361.html" width = "1" height = "1" /> ]]> re: UVA 624 CD http://www.shnenglu.com/syhd142/archive/2011/03/31/118968.html#143110Fucker Fucker Thu, 31 Mar 2011 06:32:00 GMT http://www.shnenglu.com/syhd142/archive/2011/03/31/118968.html#143110 棰濓紝鏈夌偣閬ヨ繙浜嗭紝閮藉繕璁頒簡銆?img src ="http://www.shnenglu.com/syhd142/aggbug/143110.html" width = "1" height = "1" /> ]]> re: UVA 624 CD http://www.shnenglu.com/syhd142/archive/2011/03/31/118968.html#143105alien alien Thu, 31 Mar 2011 05:57:00 GMT http://www.shnenglu.com/syhd142/archive/2011/03/31/118968.html#143105 45 8 4 10 44 43 12 9 8 2 榪欑粍鎴戠敤浣犵殑紼嬪簭璁$畻鍑烘潵鐨勬槸43 2 sum:45. 搴旇鏄? 10 12 9 8 2 sum:45 涓轟粈涔堝彲浠ヨ繖鏍瘋褰曡礬寰勶紵 ]]> re: UVA 11594 All Pairs Maximum Flow http://www.shnenglu.com/syhd142/archive/2011/02/12/119887.html#139929Ziwen Ziwen Sat, 12 Feb 2011 03:29:00 GMT http://www.shnenglu.com/syhd142/archive/2011/02/12/119887.html#139929 THX Very Simple Methods for All Pairs Network Flow Analysis caocao9926@163.com ]]> re: UVA 10003 Cutting Sticks http://www.shnenglu.com/syhd142/archive/2010/11/17/118133.html#133879jerrymu1234 jerrymu1234 Wed, 17 Nov 2010 06:01:00 GMT http://www.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 ]]> re: UVA 10819 Trouble of 13-Dots http://www.shnenglu.com/syhd142/archive/2010/11/14/118985.html#133560Fucker Fucker Sat, 13 Nov 2010 16:26:00 GMT http://www.shnenglu.com/syhd142/archive/2010/11/14/118985.html#133560 鑳屽寘涔濊閲岄潰璨屼技鏈夎銆?img src ="http://www.shnenglu.com/syhd142/aggbug/133560.html" width = "1" height = "1" /> ]]>
国产精品久久久久jk制服 |
久久国产精品久久 |
思思久久好好热精品国产 |
精品久久久久成人码免费动漫 |
色悠久久久久久久综合网
|
嫩草伊人久久精品少妇AV |
久久精品国产亚洲77777 |
99久久婷婷国产综合精品草原
|
伊人久久大香线蕉精品不卡 |
日产精品久久久久久久 |
欧美亚洲国产精品久久蜜芽 |
亚洲国产精品嫩草影院久久 |
77777亚洲午夜久久多喷 |
一级做a爰片久久毛片看看 |
99久久国产综合精品麻豆 |
伊人久久大香线蕉AV一区二区 |
av午夜福利一片免费看久久 |
色99久久久久高潮综合影院 |
久久国产免费观看精品 |
婷婷五月深深久久精品 |
久久se精品一区精品二区国产
|
久久亚洲AV永久无码精品 |
精品免费久久久久久久 |
亚洲精品乱码久久久久久按摩 |
久久国产香蕉一区精品 |
亚洲国产成人久久综合一
|
久久中文精品无码中文字幕 |
久久综合综合久久综合 |
精品熟女少妇AV免费久久 |
中文成人无码精品久久久不卡
|
久久99精品国产麻豆宅宅 |
久久青青草原亚洲av无码 |
99久久精品免费看国产一区二区三区 |
一本色道久久88精品综合 |
久久99精品国产自在现线小黄鸭 |
2021国内精品久久久久久影院 |
久久乐国产精品亚洲综合 |
久久精品国产精品亚洲艾草网美妙
|
99久久国产宗和精品1上映 |
欧美国产成人久久精品 |
伊人久久大香线蕉av不变影院 |