- 博客(7)
- 收藏
- 关注
原创 华北计算所其中一道机试题,逆转字符串,但是单词顺序不变,字符串中只含有字母和空格
#include using namespace std; int main() { char *a="this is a book"; char *p=a,*q=a; int i=strlen(a); while(i) { if(p[i-1]==
2011-09-18 21:59:32 1093
原创 方正面试的题-找出字符串最多的分解方法
有长度m(>3)的字符串M,另有n个3个字符长度的子字符串,可以是重叠的,(如123,231,), 分解字符串M,搜索与子字符串一样的字符串个数,并找出最多的分解方法。 #include using namespace std; char m[100][4]; char b[1000]; int c[997]; int strcpy1(char *s1,char *s) {
2011-09-18 21:55:51 477
原创 骑士聚会问题
在8×8的棋盘上分布着n个骑士,他们想约在某一格的中聚会,骑士每天可以像国际象棋中的马那样移动一次,如下图所示,可以从中间向8个方向移动,请你计算n个骑士的最早聚会地点和要走多少天。要求尽早聚会,且n个人走的总步数最少,先到聚会地点的骑士可以不再移动等候其他骑士。 从键
2011-09-18 00:31:20 1147
原创 高精度减法
#include #include #include using namespace std; void subtract(char *a,char *b) { int i,j,top=-1,k; if(strlen(a)>=strlen(b)) {
2011-09-12 20:32:53 367
原创 高精度加法
#include using namespace std; void add(char *a,char *b) { int i,j,k=0,carry; string s; char *c=(char *)malloc(sizeof(char)*(strlen(
2011-09-12 20:31:05 460
原创 高精度乘法
#include using namespace std; #define MAX 10000 char m[MAX]; char tmp[MAX]; void multip(char *a,char *b) { int j,k,i,d,h=0,e; for(
2011-09-12 20:06:00 427
原创 poj1753 flip game题解
#include using namespace std; #include #define MAX 65536 const int a[16]={ 0xc800,0xe400,0x7200,0x3100,
2011-09-06 11:45:58 578
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人