又见01背包时间限制:1000ms | 内存限制:65535KB难度:3描述有n个重量和价值分别为wi 和 vi 的 物品,从这些物品中选择总重量不超过 W的物品,求所有挑选方案中物品价值总和的最大值。 1 struct goods{int w,v;}goods[110];#define MAX ....
分类:
其他好文 时间:
2015-07-12 14:07:40
阅读次数:
88
规则:1.必须至少包含一个元音字母。a e i o u2.不能包含三个连续元音或者连续辅音字母。3.不能包含两个连续字母,除了'ee'和'oo'。PS:字母个数(1#include #include int is_vowel(char strIn){ if(strIn == 'a' || st...
分类:
其他好文 时间:
2015-07-12 14:03:36
阅读次数:
101
#include #include using namespace std;template class QNode{ friend void EnQueue(queue*> &Q, Type wt, int i, int n, Type bestw, QNode *E, QNode *&bestE...
分类:
其他好文 时间:
2015-07-12 14:03:14
阅读次数:
91
的输出是?
答案:构造函数的初始化列表
字符串转化为整形的代码:
enum Status{ kValid = 0,kInvalid };
int g_nStatus = kValid;
int StrToInt(const char* str)
{
g_nStatus = kInvalid;
long long num = 0;
if (str != NULL...
分类:
编程语言 时间:
2015-07-12 12:54:09
阅读次数:
190
#include
int a[100][100];
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
for(int j=1;j<=i;j++)
scanf("%d",&a[i][j]);
int maxx =0;
for(int i=2;i<=n;i...
分类:
其他好文 时间:
2015-07-12 12:53:05
阅读次数:
134
#include
#include
using namespace std;
int a[1000];
int dp[1000];
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
int maxx=0;
for(int i=1;i<=n;...
分类:
其他好文 时间:
2015-07-12 12:49:54
阅读次数:
121
$json2 = json_decode($json, true);
//echo "json2:";
//var_dump($json2);
json_encode string json_encode ( mixed $value [, int $options = 0 ] )返回 value 值的 JSON 形式
json_decode
mixed json_decode (...
分类:
Web程序 时间:
2015-07-12 12:48:40
阅读次数:
168
#include
using namespace std;
//产生任意范围的随机数。
int Grial(int i,int j )
{
int x = 0;
while (!(x>=i && x<j))
{
x = rand() % j;
}
return x;
}
int main()
{
cout <<...
分类:
编程语言 时间:
2015-07-12 12:48:22
阅读次数:
136
#include
#include
#include
#define N 10
#define L 10
//打印随机雷的位置,测试代码方便看雷
void sl_print(const
int a[L])
{
int i=0;
printf("地雷的随机位置为:");
for(i=0;i
{
printf("%02d ...
分类:
编程语言 时间:
2015-07-12 12:47:07
阅读次数:
317
字符串反转
#include "stdafx.h"
#include
using namespace std;
char*reverse_str(char*str);
int _tmain(int argc, _TCHAR* argv[])
{
char*str = "abcdefgh";
char*dst = reverse_str(str);
cout << dst << ...
分类:
其他好文 时间:
2015-07-12 12:45:18
阅读次数:
124