- 博客(6)
- 问答 (1)
- 收藏
- 关注
原创 2048
今天用c++自己写了个2048,纯练手。记录一下~//C.h 几乎各程序都需要用到的文件包含宏命令和使用名空间#ifndef _C_H_#define _C_H_#include #include #include #include #include #include #include #include #include #include #include #inc
2016-02-13 20:20:58 423
原创 poj1247对半分
#includeusing namespace std;typedef struct method{ int S,E;};int main(){ int guest[30],num,sum,half,count=0; method meth[100]; cin>>num; while(num) { half=sum=0; for(int i=0;i<num;i++)
2016-02-11 23:45:52 271
原创 poj1007DNA Sorting
#include#include#includeusing namespace std;struct DNA{ string str; int revpair;};bool cmp(const struct DNA &dna1,const struct DNA &dna2){ return (dna1.revpair<=dna2.revpair);}int main()
2016-02-09 15:28:42 270
原创 排序问题思考与总结
基于比较的排序问题的计算时间下界为Ω(nlogn)。合并排序算法(mergeSort)(是渐近最优算法),时间复杂度为O(nlogn)。思路为将数组段二分,直到得到大小为1的n个数组段,将排好序的两个数组合并,依次合并得到排好序的最终数组。其中有递归调用。自然合并排序(mergeSort的变形)消除了算法中的递归。此算法记录下已经排好序的子串。直接把排好序的数组段放在原数组中。因此,此种算
2016-02-09 14:26:40 441
原创 格雷码
#include//格雷码#include#includeusing namespace std;#pragma warning(disable:4996)void buildgray(char **gray,int n){ for(int k=0;k<=n-1;k++) { for(int i=1;i<=pow(2,k);i++) strcpy(gray[(int)po
2016-02-09 14:23:16 465
原创 poj1006中国剩余定理
#includeusing namespace std;int main(){ int p,e,i,d,re[1000],count=-1,t; while(cin>>p>>e>>i>>d) { if((p==-1)&&(e==-1)&&(i==-1)&&(d==-1)) break; re[++count]=(5544*p+14421*e+1288*i-d)%
2016-02-09 14:20:12 277
空空如也
从二进制文件中读取字符并逆转 当文件字节很大时如何提高执行效率
2016-02-24
TA创建的收藏夹 TA关注的收藏夹
TA关注的人