【题目链接】click here~~
【题目大意】n组团体去包车,每组团体的人数《=4,一辆车最多容纳4人,求所求车的数目最小
【解题思路】:思路见代码~~
// C
#ifndef _GLIBCXX_NO_ASSERT
#include
#endif
#include
#include
#include
#include
#include
#include
#include...
分类:
其他好文 时间:
2015-07-12 12:49:21
阅读次数:
104
#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
通道:http://acm.hdu.edu.cn/showproblem.php?pid=3377题意:简单路径,从左上角走到右下角的最大权值,不需要每个格子都需要经过。思路:初始化左上角上面那一格有下插头,然后一个不选状态,over.代码: 1 #include 2 #include 3...
分类:
其他好文 时间:
2015-07-12 12:42:55
阅读次数:
130
C++二级指针第二种内存模型(二维数组)二维数组 二维数组本质上是以数组作为数组元素的数组,即“数组的数组”。定义 类型说明符 数组名[常量表达式][常量表达式] 例如: float a[3][4],b[5][10];二维数组元素地址#include using namespace std;...
分类:
编程语言 时间:
2015-07-12 12:38:05
阅读次数:
282
1. SpreadsheetCell.h#pragma once#include class SpreadsheetCell{public: void setValue(double inValue); double getValue() const; void setString...
分类:
编程语言 时间:
2015-07-12 12:36:48
阅读次数:
152
#include "stdio.h"#include "stdlib.h"#include "string.h"void main(){ int i = 0, j = 0; char buf[100]; char **myarray = (char **)malloc(10*siz...
分类:
编程语言 时间:
2015-07-12 12:34:16
阅读次数:
166
#include#includetypedef int * List;/* 自调整表的Find数组实现 */intFind(List L,int MaxSize,int X){ int where = 0; for( i = 1; i 1; i-- ) { ...
分类:
其他好文 时间:
2015-07-12 12:33:57
阅读次数:
133
头:#include using namespace std;1.默认的sort函数是按升序排序。sort(a,a+n); //两个參数分别为待排序数组的首地址和尾地址2.能够自己写一个cmp函数,按特定意图进行排序。比如 :1).对数组a降序排序int cmp( const int ...
分类:
其他好文 时间:
2015-07-12 10:57:31
阅读次数:
140