午夜的留言附属站 » 日志 » TimeToSay
TimeToSay
任腾 发表于 2008-05-06 12:34:24
#include <string>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <map>
#include <set>
using namespace std;
struct TimeToSay{
int maximumJoy(vector<int> he,vector<int> jo){
int n=he.size();
int res=0;
for (int i=0;i<1<<n;i++){
int tmp=0;
int th=100;
for (int j=0;j<n;j++){
if ((1<<j)&i){
th-=he[j];
tmp+=jo[j];
}
}
if (th>0&&tmp>res){
res=tmp;
}
}
return res;
}
};
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <map>
#include <set>
using namespace std;
struct TimeToSay{
int maximumJoy(vector<int> he,vector<int> jo){
int n=he.size();
int res=0;
for (int i=0;i<1<<n;i++){
int tmp=0;
int th=100;
for (int j=0;j<n;j++){
if ((1<<j)&i){
th-=he[j];
tmp+=jo[j];
}
}
if (th>0&&tmp>res){
res=tmp;
}
}
return res;
}
};
相关日志:
收藏:
QQ书签
del.icio.us
订阅:
Google
抓虾
