2012年7月22日
摘要: 题目蛮简单,不过代码写的有点长,可能有更好的方法……下面贴出代码,以作纪念。View Code 1 /*{ 2 ID:jzy3209981 3 PROG:preface 4 LANG:C++ 5 }*/ 6 #include<stdio.h> 7 #include<iostream> 8 #include<string.h> 9 #include<math.h> 10 using namespace std; 11 12 void t(int n,char ch[20]) 13 { 14 int i=0; 15 while(n!=0) 16 { 阅读全文
posted @ 2012-07-22 11:40 醉春雨 阅读(141) 评论(0) 推荐(0)
摘要: 简单题,感觉很久没做过这么简单的题了。最小的数肯定是0,接下来枚举就行了。下面贴出代码,以作纪念。View Code 1 /*{ 2 ID:jzy3209981 3 PROG:hamming 4 LANG:C++ 5 }*/ 6 #include<stdio.h> 7 #include<iostream> 8 #include<string.h> 9 #include<math.h>10 using namespace std;11 12 int bitnum(int n)13 {14 int i=0;15 while(n!=0)16 {17 n 阅读全文
posted @ 2012-07-22 10:26 醉春雨 阅读(160) 评论(0) 推荐(0)