- 博客(5)
- 收藏
- 关注
原创 IT公司笔试题算法部分(四)
15、现在小明一家过一座桥,过桥的时候是黑夜,所以必须有灯。现在小明过桥要1秒,小明的弟弟要3秒,小明的爸爸要6秒,小明的妈妈要八秒,小明的爷爷要12秒。每次此桥最多可过两人,而过桥的速度依过桥最慢者而定,而且灯在点燃后30秒就会熄灭。问小明一家如何过桥?(原本是个智力题,这里用程序来求解)#include "stdafx.h"#define N 5#define SIZE
2007-05-09 00:34:00 3399
原创 IT公司笔试题算法部分(三)
20、快速排序(东软喜欢考类似的算法填空题,又如堆排序的算法等)#include "stdafx.h"#define N 10int part(int list[], int low, int high) // 一趟排序,返回分割点位置{ int tmp = list[low]; while(low while(low=tmp)
2007-05-08 23:18:00 3053 1
原创 IT公司笔试题算法部分(二)
9、有4种面值(面值为1, 4, 12, 21)的邮票很多枚,从中最多任取5张进行组合,求邮票最大连续组合值#define N 5#define M 5int k, Found, Flag[N];int Stamp[M] = {0, 1, 4, 12, 21}; // 在剩余张数n中组合出面值和Valueint Combine(int n, int Value)
2007-05-08 23:17:00 2451
原创 IT公司笔试题算法部分(一)
1、将一整数逆序后放入一数组中(要求递归实现)void convert(int *result, int n){ if(n>=10) convert(result+1, n/10); *result = n%10; }int main(int argc, char* argv[]){ int n = 12345678
2007-05-08 23:16:00 2592
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人