Coding Change World

代码改变世界

2017年8月7日

使用lua实现99乘法口诀表,就这么简洁

摘要: for i=1,9 do for j=1,i do io.write(j,"*",i,"=",i*j," ") end print() end 阅读全文

posted @ 2017-08-07 09:15 alphaxz 阅读(556) 评论(0) 推荐(0) 编辑

2017年7月27日

Linux "ls -l"文件列表权限详解 【转】

摘要: 1.使用 ls -l 命令 执行结果如下(/var/log) :drwxr-x 2 root adm 4096 2013-08-07 11:03 apache2drwxr-xr-x 2 root root 4096 2013-08-07 09:43 apparmordrwxr-xr-x 2 root 阅读全文

posted @ 2017-07-27 14:42 alphaxz 阅读(653) 评论(0) 推荐(1) 编辑

2017年7月25日

vmware10.0.1安装redhat linux6.2每次启动vm崩溃问题解决!

摘要: 最近在学习linux技术,安装了一套redhat linux6.2的环境,里面有软件若干,wmare用的是10.0.1的,最近每次出现登陆界面,输入root登陆后,wm就报错vmui不可恢复错误MEM_ALLOC,这个对话框如果不点掉,虚拟机还能正常使用,点掉了虚拟机窗口就直接不见了,但是进程还在, 阅读全文

posted @ 2017-07-25 16:18 alphaxz 阅读(408) 评论(0) 推荐(0) 编辑

2014年1月7日

BSTR 的奥秘

摘要: 初学COM,总觉得BSTR很神秘,对于这种新的数据类型,总有很多疑问,那么BSTR到底是什么类型呢?我们可以在头文件中的定义中最终找到 wchar这个类型被定义为BSTR,那么BSTR是wchar吗?答案是:不完全是!为什么说不完全是,如果BSTR是wchar的话,完全没必要搞个BSTR这种类型出啦,我们完全可以用WCHAR,想想我们如何获得一个BSTR类型,需要系统API:SysAllocString,这个函数是微软的api,他会返回一个BSTR类型给我们,但是他返回的地址并不是BSTR的首地址,而是从首地址开始向后4个字节,所以BSTR类型前面还会有4个字节是BSTR的空间,那么这4个字节 阅读全文

posted @ 2014-01-07 11:29 alphaxz 阅读(154) 评论(0) 推荐(0) 编辑

2013年12月31日

PKU 1006

摘要: 数学问题吧,有兴趣的可以研究一下“中国剩余定理”// 1006.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;int main(int argc, char* argv[]){ int p=0,e=0,i=0,d=0; int a=23,b=28,c=33; int a1=0,b1=0,c1=0; for (int j=0;;j++) { if (a1!=0&&b1!=0&&c1!=0) { break; }... 阅读全文

posted @ 2013-12-31 19:20 alphaxz 阅读(155) 评论(0) 推荐(0) 编辑

2013年12月20日

PKU1008

摘要: 题名:玛雅历题意:历法转换 。代码:// 1008.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;class data{public: char day[200]; char mon[200]; char year[200];};int main(int argc, char* argv[]){ int num=0; cin>>num; char temp[256]={0}; data *s=new data[num]; for (int i=0;i>s... 阅读全文

posted @ 2013-12-20 09:54 alphaxz 阅读(206) 评论(0) 推荐(0) 编辑

2013年12月19日

PKU 1007

摘要: 题名:DNA排序题意:给定字符串长度、个数,计算每个字符串的逆序数,然后从大到小排列,有兴趣的可以去看下原题。计算字符串逆序数,然后排序,这里使用了快速排序算法,string释放的时候竟然有问题,直接字符数组吧。// 1007.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include using namespace std;class data{public: char s[51]; int c;};int partion(data a[],int p,int r){ int x = a[r].c; //通常... 阅读全文

posted @ 2013-12-19 16:34 alphaxz 阅读(580) 评论(0) 推荐(0) 编辑

2013年12月18日

PKU 3983

摘要: 很久前写了一个24点的算法,刚好POJ上也有个24点,顺便给解了,POJ上的相对于我原始来写的较为简单许多,因为,限制了数字的位置固定,实际上24点的话是不可能限制这个固定的,所以我之前会对数据进行一次排列,4个数据,按照位置不同的话就会有24种排列4*3*2*1 ,这个算法因为位置固定,而且只需要求一个解就可以,总体来说简单不少,下面贴代码#include #include using namespace std;int fun3(double a,double b,double c,double d) // a t (b t (c t d)) { int i,j,k; ... 阅读全文

posted @ 2013-12-18 17:24 alphaxz 阅读(232) 评论(0) 推荐(0) 编辑

2013年12月17日

PKU 1005

摘要: 比较简单吧,其实算是数学问题了// 1005.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "stdio.h"#include "iostream"using namespace std;#define pi 3.1415926int main(int argc, char* argv[]){ int n=0; cin>>n; int year=0; int i=0; int *res =new int[n]; while (i>a>>b; doubl 阅读全文

posted @ 2013-12-17 14:10 alphaxz 阅读(201) 评论(0) 推荐(0) 编辑
PKU1004

摘要: 求平均数,就是要注意浮点数精度保持,由于浮点数在计算机内部的表示不同,会导致精度不好,这里由于输入的限制,计算的时候采用了整数,防止精度丢失// 1004.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "stdio.h"int main(int argc, char* argv[]){ float f=0; int total=0; int count=1; while (count<=12) { scanf("%f",&f); f=f*100.00; total+= 阅读全文

posted @ 2013-12-17 12:56 alphaxz 阅读(156) 评论(0) 推荐(0) 编辑