![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++/C类
文章平均质量分 85
00M
keep alive
展开
-
C++获取毫秒级别的当前时间
#include #include #include int main (){SYSTEMTIME lpsystime;GetLocalTime(&lpsystime);printf("%u:%u:%u:%u:%u:%u:%u:%u\n",lp原创 2011-08-22 10:37:02 · 7431 阅读 · 0 评论 -
求用1,2,5这三个数不同个数组合的和为100的组合个数
写一个程序, 要求功能:求出用1,2,5这三个数不同个数组合的和为100的组合个数。如:100个1是一个组合,5个1加19个5是一个组合。。。。 答案:最容易想到的算法是:设x是1的个数,y是2的个数,z是5的个数,number是组合数注意到0number=0;for (x=0; x<=100; x++)for (y=0; y<=50; y++)for (z=转载 2011-09-15 09:11:23 · 4019 阅读 · 0 评论 -
C++实现大整数乘法
//大整数乘法#include#includeusing namespace std;void MUL_max(string a,int la,string b,int lb,int **c);//相乘函数void ADD_max(int * d,int **c,int la,int lb);//相加函数char * ZhuanH(string);void ma原创 2011-05-08 19:11:00 · 7755 阅读 · 0 评论 -
合并排序的各种实现方式
用递归实现:#include #include template void MergeSort(T a[],int left,int right); template void Merge(T c[],T d[],int l,int m,int r); template void Copy(T a[],T b[],int l,int r); /*数组实现递归合并排序原创 2011-05-06 12:45:00 · 1094 阅读 · 0 评论 -
数组实现快速排序
//数组实现快速排序#include using namespace std;void sort(int array[],int X,int Y) { int z,y,i,k; if(X<Y) { z=X; y=Y; k=array[z]; //key值 do { while((z=k)) y--;原创 2011-05-08 19:12:00 · 3736 阅读 · 0 评论 -
微软面试题(收集)
1、在排序数组中,找出给定数字的出现次数,比如 [1, 2, 2, 2, 3] 中2的出现次数是3次。#include extern int low=0,high=10,mid=0;void find(int *a,int p)//找到P的其中位置{ int i=0,j=0; while(low<high && j==0) { mid=(low+hig原创 2011-09-15 13:59:25 · 700 阅读 · 0 评论 -
矩阵链乘法C++实现
#include#define MAX_SIZE 100using namespace std;int num;int size[MAX_SIZE],s[MAX_SIZE][MAX_SIZE];int ji[MAX_SIZE][MAX_SIZE];void opt_matrix_muln(int size[]){ int n=num; int i,j,k,w,q原创 2011-05-08 19:15:00 · 2156 阅读 · 0 评论