锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产成人精品久久一区二区三区,狠狠综合久久综合88亚洲 ,狠狠色丁香久久婷婷综合图片http://www.shnenglu.com/yuziyu/archive/2009/07/12/89864.htmlYZYYZYSun, 12 Jul 2009 06:58:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/07/12/89864.htmlhttp://www.shnenglu.com/yuziyu/comments/89864.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/07/12/89864.html#Feedback0http://www.shnenglu.com/yuziyu/comments/commentRss/89864.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/89864.html鍏堝皢box榪涜鎺掑簭銆?br />濡傛灉box閲岄潰鐨勬暟鐨勬渶澶у叕綰︽暟涓嶄負1鐨勮瘽錛岄偅涔堟墍鏈夌粍鎴愮殑鏁幫紝鍙彲鑳芥槸榪欎釜鍏害鏁扮殑鍊嶆暟錛屽洜姝ゆ病鏈変笂闄愶紝杈撳嚭涓?.
鐢╨ast璁板綍鏈灝忕殑鈥滀笉鑳界粍鎴愮殑鏁扳濄傝繖鏍峰綋last涔嬪悗鏈塨oxs[0]涓繛緇暟閮藉彲浠ョ粍鎴愮殑璇濓紝閭d箞鎵鏈夌殑鏁伴兘鍙互緇勬垚銆?br />last+1...last+box[0]鍙互緇勬垚鐨勮瘽錛岄偅涔堟瘡涓暟閮藉姞涓涓猙ox[0],閭d箞鏂頒竴杞殑box[0]涓暟涔熷彲浠ョ粍鎴愶紝浠ユ綾繪帹銆?br />
#include聽<iostream>
#include聽
<fstream>

usingnamespace聽std;

ifstream聽fin(
"nuggets.in");
ofstream聽fout(
"nuggets.out");

#ifdef聽_DEBUG
#define聽out聽cout
#define聽in聽cin
#else
#define聽out聽fout
#define聽in聽fin
#endif

int聽box_num;
int聽boxs[10];

bool聽ok[256];

int聽gcd(int聽a,int聽b)
{
聽聽聽聽
if(a<b)聽swap(a,b);

聽聽聽聽
int聽tmp;

聽聽聽聽
while(b!=0){
聽聽聽聽聽聽聽聽tmp聽
=聽a;
聽聽聽聽聽聽聽聽a聽
=聽b;
聽聽聽聽聽聽聽聽b聽
=聽tmp%b;
聽聽聽聽}

聽聽聽聽
return聽a;
}

void聽solve()
{

聽聽聽聽
in>>box_num;
聽聽聽聽
for(int聽i=0;i<box_num;++i)
聽聽聽聽聽聽聽聽
in>>boxs[i];

聽聽聽聽sort(
&boxs[0],&boxs[box_num]);
聽聽聽聽
聽聽聽聽
int聽t聽=聽boxs[0];

聽聽聽聽
for(int聽i=1;i<box_num;++i){
聽聽聽聽聽聽聽聽t聽
=聽gcd(t,boxs[i]);
聽聽聽聽}

聽聽聽聽
if(t!=1){
聽聽聽聽聽聽聽聽
out<<0<<endl;
聽聽聽聽聽聽聽聽
return;
聽聽聽聽}

聽聽聽聽memset(ok,
0,sizeof(ok));

聽聽聽聽
int聽last聽=0;
聽聽聽聽ok[
0]聽=true;
聽聽聽聽
int聽i=0;

聽聽聽聽
while(true){
聽聽聽聽聽聽聽聽
if(ok[i%256]){
聽聽聽聽聽聽聽聽聽聽聽聽ok[i
%256]聽=0;
聽聽聽聽聽聽聽聽聽聽聽聽
if(i-last>=boxs[0]){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
out<<last<<endl;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
return;
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽x=0;x<box_num;++x){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽ok[(i
+boxs[x])%256]聽=true;
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽}
else{
聽聽聽聽聽聽聽聽聽聽聽聽last聽
=聽i;
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
++i;
聽聽聽聽}
}

int聽main(int聽argc,char*argv[])
{
聽聽聽聽solve();聽
聽聽聽聽
return0;
}


Beef McNuggets

Hubert Chen

Farmer Brown's cows are up in arms, having heard that McDonalds is considering the introduction of a new product: Beef McNuggets. The cows are trying to find any possible way to put such a product in a negative light.

One strategy the cows are pursuing is that of `inferior packaging'. ``Look,'' say the cows, ``if you have Beef McNuggets in boxes of 3, 6, and 10, you can not satisfy a customer who wants 1, 2, 4, 5, 7, 8, 11, 14, or 17 McNuggets. Bad packaging: bad product.''

Help the cows. Given N (the number of packaging options, 1 <= N <= 10), and a set of N positive integers (1 <= i <= 256) that represent the number of nuggets in the various packages, output the largest number of nuggets that can not be purchased by buying nuggets in the given sizes. Print 0 if all possible purchases can be made or if there is no bound to the largest number.

The largest impossible number (if it exists) will be no larger than 2,000,000,000.

PROGRAM NAME: nuggets

INPUT FORMAT

Line 1: N, the number of packaging options
Line 2..N+1: The number of nuggets in one kind of box

SAMPLE INPUT (file nuggets.in)

3
3
6
10

OUTPUT FORMAT

The output file should contain a single line containing a single integer that represents the largest number of nuggets that can not be represented or 0 if all possible purchases can be made or if there is no bound to the largest number.

SAMPLE OUTPUT (file nuggets.out)

17


YZY 2009-07-12 14:58 鍙戣〃璇勮
]]>
USACO 3.3 A Gamehttp://www.shnenglu.com/yuziyu/archive/2009/07/09/89638.htmlYZYYZYThu, 09 Jul 2009 05:50:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/07/09/89638.htmlhttp://www.shnenglu.com/yuziyu/comments/89638.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/07/09/89638.html#Feedback0http://www.shnenglu.com/yuziyu/comments/commentRss/89638.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/89638.html鍔ㄦ佽鍒掓硶銆?br />鐢╠p[player][start][end]琛ㄧずplayer鍦╗start..end]浼氬彇寰楃殑鏈澶у箋?br />濡傛灉player==0錛岄偅涔坧layer鏈変富鍔ㄦ潈錛屽畠瑕佷箞閫塻tart,瑕佷箞閫塭nd.鏄劇劧錛屽畠瑕侀変嬌寰楀鎵嬪緱鍒嗘渶灝戠殑閭d竴涓?br />褰撳畠閫塻tart鏃訛紝瀵規墜鎵鑳藉埌鐨勬渶澶у間負dp[1][start+1][end]銆傚綋瀹冮塭nd鏃訛紝瀵規墜鎵閫夌殑鏈澶у兼槸dp[1][start][end-1].
銆傛墍浠ユ垜浠塪p[1][start+1][end]鍜宒p[1][start][end-1]涓皬鐨勯偅涓涓?br />濡傛灉player==1錛岄偅鍙兘琚姩鐨勭瓑0鍏堥変簡銆?鍦ㄥ墿涓嬪尯孌典腑錛屽張浣滀負鍏堥夌殑瑙掕壊錛屽嵆player0銆?br />褰撳彧鏈変竴涓暟瀛楃殑鏃跺欙紝player0灝卞彧鏈夐夎繖涓紝player1灝辨病寰楅夛紝榪斿洖0.
浠g爜濡備笅錛?br />
#include聽<iostream>
#include聽
<fstream>

usingnamespace聽std;

ifstream聽fin(
"game1.in");
ofstream聽fout(
"game1.out");

#ifdef聽_DEBUG
#define聽out聽cout
#define聽in聽cin
#else
#define聽out聽fout
#define聽in聽fin
#endif

int聽dp[2][100][100];
int聽sequence[100];

int聽score(int聽player,int聽start,int聽end)
{
聽聽聽聽
if(dp[player][start][end]!=-1)
聽聽聽聽聽聽聽聽
return聽dp[player][start][end];

聽聽聽聽
if(start==end){
聽聽聽聽聽聽聽聽
if(player==0)
聽聽聽聽聽聽聽聽聽聽聽聽dp[player][start][end]聽
=聽sequence[start];
聽聽聽聽聽聽聽聽
else
聽聽聽聽聽聽聽聽聽聽聽聽dp[player][start][end]聽
=0;
聽聽聽聽}
else{
聽聽聽聽聽聽聽聽
int聽t1聽=聽score(0,start+1,end);
聽聽聽聽聽聽聽聽
int聽t2聽=聽score(0,start,end-1);
聽聽聽聽聽聽聽聽
if(player==0){
聽聽聽聽聽聽聽聽聽聽聽聽
if(t1>t2){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽dp[player][start][end]聽
=聽sequence[end]+score(1,start,end-1);
聽聽聽聽聽聽聽聽聽聽聽聽}
else{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽dp[player][start][end]聽
=聽sequence[start]+score(1,start+1,end);
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽}
else{
聽聽聽聽聽聽聽聽聽聽聽聽
if(t1>t2){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽dp[player][start][end]聽
=聽score(0,start,end-1);
聽聽聽聽聽聽聽聽聽聽聽聽}
else{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽dp[player][start][end]聽
=聽score(0,start+1,end);
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽}
聽聽聽聽}

聽聽聽聽
return聽dp[player][start][end];
}

void聽solve()
{
聽聽聽聽memset(dp,
-1,sizeof(dp));

聽聽聽聽
int聽size;
聽聽聽聽
in>>size;

聽聽聽聽
for(int聽i=0;i<size;++i)
聽聽聽聽聽聽聽聽
in>>sequence[i];

聽聽聽聽
out<<score(0,0,size-1)<<""<<score(1,0,size-1)<<endl;
}

int聽main(int聽argc,char*argv[])
{
聽聽聽聽solve();聽
聽聽聽聽
return0;
}




YZY 2009-07-09 13:50 鍙戣〃璇勮
]]>
USACO 3.3 Home on the Rangehttp://www.shnenglu.com/yuziyu/archive/2009/07/08/89557.htmlYZYYZYWed, 08 Jul 2009 09:44:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/07/08/89557.htmlhttp://www.shnenglu.com/yuziyu/comments/89557.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/07/08/89557.html#Feedback0http://www.shnenglu.com/yuziyu/comments/commentRss/89557.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/89557.html濡傛灉dp[i][j][m]瀹屾暣錛屽垯褰撲笖浠呭綋dp[i][j][m-1],dp[i+1][j][m-1],dp[i][j+1][m-1],dp[i+1][j+1][m-1]鐨勬鏂瑰艦涔熸槸瀹屾暣鐨?鐢諱釜鍥懼氨寰堟竻鏅頒簡)銆傜敱浜庢垜浠粠涓婂埌涓嬶紝浠庡乏鍒板彸鎵弿姣忎釜鐐癸紝鍦ㄦ瘡涓杞甶,j鐢ㄨ繃涓嬈★紝灝變笉浼氬啀浣跨敤錛屾墍浠ュ彧闇鐢ㄤ簩緇存暟緇勪繚瀛榙p[i][j]錛屽嵆鍙?br />鏃墮棿澶嶆潅搴︿負O(n^3),絀洪棿澶嶆潅搴︿負O(n^2)銆俛nalysis涓湁涓椂闂村鏉傚害涓篛(n^2),絀洪棿O(n)鐨勮В娉曘?br />
#include聽<iostream>
#include聽
<fstream>

usingnamespace聽std;

ifstream聽fin(
"range.in");
ofstream聽fout(
"range.out");

#ifdef聽_DEBUG
#define聽out聽cout
#define聽in聽cin
#else
#define聽out聽fout
#define聽in聽fin
#endif

bool聽dp[250][250];
int聽side_len;

void聽input()
{
聽聽聽聽
in>>side_len;

聽聽聽聽
char聽t;

聽聽聽聽
for(int聽i=0;i<side_len;++i){
聽聽聽聽聽聽聽聽
for(int聽j=0;j<side_len;++j){
聽聽聽聽聽聽聽聽聽聽聽聽
while(聽in.get(t)&&isspace(t)聽);
聽聽聽聽聽聽聽聽聽聽聽聽dp[i][j]聽
=聽t-'0';
聽聽聽聽聽聽聽聽}
聽聽聽聽}
}

void聽solve()
{
聽聽聽聽input();

聽聽聽聽
for(int聽w聽=2;w<=side_len;++w){
聽聽聽聽聽聽聽聽
int聽cnt聽=0;

聽聽聽聽聽聽聽聽
for(int聽i=0;i<side_len;++i){
聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽j=0;j<side_len;++j){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(i+w<=side_len&&j+w<=side_len){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽dp[i][j]聽
=聽dp[i][j]&&dp[i+1][j]&&dp[i][j+1]&&dp[i+1][j+1];
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(dp[i][j])
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽cnt
++;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽}

聽聽聽聽聽聽聽聽
if(cnt!=0){
聽聽聽聽聽聽聽聽聽聽聽聽
out<<w<<""<<cnt<<endl;
聽聽聽聽聽聽聽聽}
聽聽聽聽}
}

int聽main(int聽argc,char*argv[])
{
聽聽聽聽solve();聽
聽聽聽聽
return0;
}





YZY 2009-07-08 17:44 鍙戣〃璇勮
]]>
USACO 3.3 Shopping Offershttp://www.shnenglu.com/yuziyu/archive/2009/07/07/89483.htmlYZYYZYTue, 07 Jul 2009 11:16:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/07/07/89483.htmlhttp://www.shnenglu.com/yuziyu/comments/89483.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/07/07/89483.html#Feedback2http://www.shnenglu.com/yuziyu/comments/commentRss/89483.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/89483.htmldp[i][j][k][m][n]琛ㄧず絎?-4縐嶇墿鍝佸垎鍒喘涔癷-n涓椂錛屾墍闇鐨勬渶灝忚垂鐢ㄣ?br />閭d箞瀵逛簬姣忎竴涓猳ffer
dp[i][j][k][m][n] = min ( dp[i][j][k][m][n], dp[i-o[0]][j-o[1]][k-o[2]][m-o[3]][n-o[4]]+offer.cost);

analysis涓彁鍑虹敤鏈鐭礬寰勭殑鏂規硶鏉ヨВ錛屾濊礬寰堝閥濡欍傛妸鈥濊鏈変笉鍚岀鏁板拰鏁伴噺鐨勭墿鍝佲滅殑綃瓙鐪嬩綔緇撶偣錛屾妸offer浣滀負杈?鎶婅喘涔頒竴浠剁墿鍝佺殑鍘熷浠鋒牸鐪嬫垚涓縐嶉鍖栫殑offer)錛屾妸浠鋒牸浣滀負杈歸暱搴︺傝繖鏍峰氨杞崲鎴愪粠綃瓙(0,0,0,0,0)鍒版墍姹傜粨鐐圭殑鏈鐭礬寰勯棶棰樸?br />
浠g爜濡備笅:
#include聽<iostream>
#include聽
<fstream>

usingnamespace聽std;

ifstream聽fin(
"shopping.in");
ofstream聽fout(
"shopping.out");

#ifdef聽_DEBUG
#define聽out聽cout
#define聽in聽cin
#else
#define聽out聽fout
#define聽in聽fin
#endif

int聽dp[6][6][6][6][6];

struct聽offer{
聽聽聽聽
int聽pro_num;
聽聽聽聽
int聽price;
聽聽聽聽
int聽product[5];
聽聽聽聽
int聽amount[5];
};

int聽offer_num;
offer聽offers[
100];
int聽map[1000]; //product id鍒扳濇寜鐗╁搧鍑虹幇欏哄簭鎵緇欑殑緙栧彿鈥滅殑鏄犲皠
int聽price[1000];//product id瀵瑰簲鐨勭墿鍝佷環鏍?br />int聽product_num;//鐗╁搧鎬繪暟鐩?br />int聽products[5];//瀛樻斁product id
int聽amount[5];//product 鎵闇鐨勬暟閲?br />
void聽solve()
{
聽聽聽聽
in>>offer_num;

聽聽聽聽
for(int聽i=0;i<offer_num;++i){
聽聽聽聽聽聽聽聽
in>>offers[i].pro_num;
聽聽聽聽聽聽聽聽
for(int聽j=0;j<offers[i].pro_num;++j){
聽聽聽聽聽聽聽聽聽聽聽聽
in>>offers[i].product[j]>>offers[i].amount[j];
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
in>>offers[i].price;
聽聽聽聽}
聽聽聽聽
聽聽聽聽
int聽pro_idx聽=0;

聽聽聽聽
in>>product_num;

聽聽聽聽
for(int聽i=0;i<product_num;++i){
聽聽聽聽聽聽聽聽
in>>products[i];
聽聽聽聽聽聽聽聽
in>>amount[i];
聽聽聽聽聽聽聽聽
in>>price[i];
聽聽聽聽聽聽聽聽map[聽products[i]聽]聽
=聽i;
聽聽聽聽}

聽聽聽 //娌℃湁鎶樻墸鏃剁殑浠鋒牸
聽聽聽聽
for(int聽i=0;i<=5;++i)
聽聽聽聽聽聽聽聽
for(int聽j=0;j<=5;++j)
聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽k=0;k<=5;++k)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽m=0;m<=5;++m)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽n=0;n<=5;++n){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽dp[i][j][k][m][n]聽
=
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽price[
0]*i+
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽price[
1]*j+
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽price[
2]*k+
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽price[
3]*m+
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽price[
4]*n;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}

聽聽聽聽
for(int聽i=0;i<=5;++i)
聽聽聽聽聽聽聽聽
for(int聽j=0;j<=5;++j)
聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽k=0;k<=5;++k)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽m=0;m<=5;++m)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽n=0;n<=5;++n){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
int聽tmp[5];
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽s=0;s<offer_num;++s){

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽memset(tmp,
0,sizeof(tmp));聽聽聽聽
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽t=0;t<offers[s].pro_num;++t){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽tmp[map[offers[s].product[t]]]聽
=聽offers[s].amount[t];
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(i>=tmp[0]&&j>=tmp[1]&&k>=tmp[2]&&m>=tmp[3]&&n>=tmp[4]){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽dp[i][j][k][m][n]聽
=聽min(聽dp[i][j][k][m][n],
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽dp[i
-tmp[0]][j-tmp[1]][k-tmp[2]][m-tmp[3]][n-tmp[4]]+
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽offers[s].price);
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}

聽聽聽聽
out<<dp[amount[0]][amount[1]][amount[2]][amount[3]][amount[4]]<<endl;
}

int聽main(int聽argc,char*argv[])
{
聽聽聽聽solve();聽
聽聽聽聽
return0;
}


涓婇潰浠g爜鏈変釜涓ラ噸鐨刡ug錛岃阿璋㈢綉鍙嬧滄垜涔熷噾鐑椆"鎸囧嚭銆傜敱浜巑ap鎵鏈夊奸兘涓?銆傛墍浠ユ湭鍦ㄥ晢鍝佸垪琛ㄤ腑鍑虹幇鐨勫晢鍝佺殑map鍊奸兘涓?錛屽嵆閮芥槧灝勪負絎竴涓晢鍝併傜幇鏀規垚灝唌ap鍒濆鍖栦負-1錛屽茍澧炲姞鍒ゆ柇璇彞銆傛澶栧皢鍒濆鍖杁p鐨勮鍙ュ悎騫跺埌鍚庨潰錛屼互綆鍖栦唬鐮併?br />

#include聽<iostream>
#include聽
<fstream>

usingnamespace聽std;

ifstream聽fin(
"shopping.in");
ofstream聽fout(
"shopping.out");

#ifdef聽_DEBUG
#define聽out聽cout
#define聽in聽cin
#else
#define聽out聽fout
#define聽in聽fin
#endif

int聽dp[6][6][6][6][6];

struct聽offer{
聽聽聽聽
int聽pro_num;
聽聽聽聽
int聽price;
聽聽聽聽
int聽product[5];
聽聽聽聽
int聽amount[5];
};

int聽offer_num;
offer聽offers[
100];
int聽map[1000];
int聽price[1000];
int聽product_num;
int聽products[5];
int聽amount[5];

void聽solve()
{
聽聽聽聽
in>>offer_num;

聽聽聽聽
for(int聽i=0;i<offer_num;++i){
聽聽聽聽聽聽聽聽
in>>offers[i].pro_num;
聽聽聽聽聽聽聽聽
for(int聽j=0;j<offers[i].pro_num;++j){
聽聽聽聽聽聽聽聽聽聽聽聽
in>>offers[i].product[j]>>offers[i].amount[j];
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
in>>offers[i].price;
聽聽聽聽}
聽聽聽聽
聽聽聽聽
int聽pro_idx聽=0;

聽聽聽聽
in>>product_num;

聽聽聽聽
//2009.07.27淇敼
聽聽聽聽memset(map,-1,sizeof(map));

聽聽聽聽
for(int聽i=0;i<product_num;++i){
聽聽聽聽聽聽聽聽
in>>products[i];
聽聽聽聽聽聽聽聽
in>>amount[i];
聽聽聽聽聽聽聽聽
in>>price[i];
聽聽聽聽聽聽聽聽map[聽products[i]聽]聽
=聽i;
聽聽聽聽}

聽聽聽聽
for(int聽i=0;i<=5;++i)
聽聽聽聽聽聽聽聽
for(int聽j=0;j<=5;++j)
聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽k=0;k<=5;++k)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽m=0;m<=5;++m)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽n=0;n<=5;++n){

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽dp[i][j][k][m][n]聽
=
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽price[
0]*i+
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽price[
1]*j+
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽price[
2]*k+
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽price[
3]*m+
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽price[
4]*n;

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
int聽tmp[5];
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽s=0;s<offer_num;++s){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽memset(tmp,
0,sizeof(tmp));聽聽聽聽
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
for(int聽t=0;t<offers[s].pro_num;++t){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
//2009.07.27淇敼
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽if(聽map[offers[s].product[t]]!=-1)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽tmp[map[offers[s].product[t]]]聽
=聽offers[s].amount[t];
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if(i>=tmp[0]&&j>=tmp[1]&&k>=tmp[2]&&m>=tmp[3]&&n>=tmp[4]){
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽dp[i][j][k][m][n]聽
=聽min(聽dp[i][j][k][m][n],
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽dp[i
-tmp[0]][j-tmp[1]][k-tmp[2]][m-tmp[3]][n-tmp[4]]+
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽offers[s].price);
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}

聽聽聽聽
out<<dp[amount[0]][amount[1]][amount[2]][amount[3]][amount[4]]<<endl;
}

int聽main(int聽argc,char*argv[])
{
聽聽聽聽solve();聽
聽聽聽聽
return0;
}






YZY 2009-07-07 19:16 鍙戣〃璇勮
]]>
USACO 3.1 Stampshttp://www.shnenglu.com/yuziyu/archive/2009/06/30/88924.htmlYZYYZYTue, 30 Jun 2009 12:37:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/06/30/88924.htmlhttp://www.shnenglu.com/yuziyu/comments/88924.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/06/30/88924.html#Feedback8http://www.shnenglu.com/yuziyu/comments/commentRss/88924.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/88924.html闃呰鍏ㄦ枃

YZY 2009-06-30 20:37 鍙戣〃璇勮
]]>
USACO 3.1 Score Inflationhttp://www.shnenglu.com/yuziyu/archive/2009/06/29/88840.htmlYZYYZYMon, 29 Jun 2009 14:21:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/06/29/88840.htmlhttp://www.shnenglu.com/yuziyu/comments/88840.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/06/29/88840.html#Feedback0http://www.shnenglu.com/yuziyu/comments/commentRss/88840.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/88840.html闃呰鍏ㄦ枃

YZY 2009-06-29 22:21 鍙戣〃璇勮
]]>
USACO 2.3 Money Systemshttp://www.shnenglu.com/yuziyu/archive/2009/06/25/88530.htmlYZYYZYThu, 25 Jun 2009 14:16:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/06/25/88530.htmlhttp://www.shnenglu.com/yuziyu/comments/88530.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/06/25/88530.html#Feedback0http://www.shnenglu.com/yuziyu/comments/commentRss/88530.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/88530.html闃呰鍏ㄦ枃

YZY 2009-06-25 22:16 鍙戣〃璇勮
]]>
USACO 2.3 Cow Pedigreeshttp://www.shnenglu.com/yuziyu/archive/2009/06/24/88453.htmlYZYYZYWed, 24 Jun 2009 12:55:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/06/24/88453.htmlhttp://www.shnenglu.com/yuziyu/comments/88453.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/06/24/88453.html#Feedback0http://www.shnenglu.com/yuziyu/comments/commentRss/88453.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/88453.html闃呰鍏ㄦ枃

YZY 2009-06-24 20:55 鍙戣〃璇勮
]]>
USACO 2.3 Longest Prefixhttp://www.shnenglu.com/yuziyu/archive/2009/06/23/88394.htmlYZYYZYTue, 23 Jun 2009 13:13:00 GMThttp://www.shnenglu.com/yuziyu/archive/2009/06/23/88394.htmlhttp://www.shnenglu.com/yuziyu/comments/88394.htmlhttp://www.shnenglu.com/yuziyu/archive/2009/06/23/88394.html#Feedback0http://www.shnenglu.com/yuziyu/comments/commentRss/88394.htmlhttp://www.shnenglu.com/yuziyu/services/trackbacks/88394.html闃呰鍏ㄦ枃

YZY 2009-06-23 21:13 鍙戣〃璇勮
]]>
要久久爱在线免费观看| 91精品国产91久久久久久蜜臀| 久久这里只有精品首页| 伊人久久无码中文字幕| 久久天天躁狠狠躁夜夜avapp| 亚洲欧洲久久av| av色综合久久天堂av色综合在 | 久久久无码精品亚洲日韩按摩| 久久一区二区三区99| 久久午夜综合久久| 一个色综合久久| AV无码久久久久不卡蜜桃| 久久久精品人妻一区二区三区蜜桃 | 性欧美丰满熟妇XXXX性久久久| 久久久久国产精品人妻| 日产精品99久久久久久| 狠狠狠色丁香婷婷综合久久五月| 国产成人精品综合久久久| 久久亚洲色一区二区三区| 99久久国产宗和精品1上映| 精品国产乱码久久久久久1区2区 | 精品国产乱码久久久久久浪潮| 国产亚洲精午夜久久久久久| 亚洲国产精品无码久久九九 | 99久久国产精品免费一区二区| 久久综合给合久久狠狠狠97色| 久久成人影院精品777| 欧美亚洲日本久久精品| 久久亚洲精品成人av无码网站| 国产精品嫩草影院久久| 久久精品国产2020| 亚洲国产精品久久久久婷婷老年| 亚洲国产日韩欧美久久| 九九精品99久久久香蕉| 亚洲国产成人久久综合野外| 久久久精品久久久久久 | 亚洲v国产v天堂a无码久久| 久久精品国产亚洲av麻豆图片| 精品久久久久久无码专区不卡| 久久精品国产亚洲一区二区三区| 亚洲va国产va天堂va久久|