`
ackerman
  • 浏览: 72861 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
/** *正整数n,m,从数列1、2、3、...、n中随意取几个数。使其和等于m *要求将其中所有可能的组合列出来 */ #include <stdio.h> #include <string.h> #include <stdlib.h> int *out; int out_size; void bag(int n, int m) { int i; if (n < 1 || m < 1 || (n == 1 && m != 1)) ...
  /** *求一字符串所有字串的组合 */ #include <stdio.h> #include <string.h> void str_combine(char src[],char out[], int leng, int rec, int start) { int i; for(i=start;i<leng;i++){ out[rec]=src[i]; out[rec+1]='\0'; printf ...
  /** * 求解x1+x2+x3+...+x10 = 10 的非负整数解 */ #include<stdio.h> static int ans_sum ; int n=10; int numx=10; int ans[10]; void print_ans() { int i; for (i = numx - 1; i >= 0; i--) { printf("%d ", ans[i]); } printf("\n ...
http://blog.sina.com.cn/s/blog_4e668bc80100sa0n.html
结构体默认的字节对齐一般满足三个准则: 结构体变量的首地址能够被其最宽基本类型成员的大小所整除; 结构体每个成员相对于结构体首地址的偏移量(offset)都是成员自身大小的整数倍,如有需要编译器会在成员之间加上填充字节(internal adding); 结构体的总大小为结构体最宽基本类型成员大小的整数倍,如有需要编译器会在最末一个成员之后加上填充字节(trailing padding)。 http://www.cnblogs.com/bettermanlu/archive/2010/05/24/1743119.html  
#ifndef _LIST_H_ #define _LIST_H_ /* simple (cyclic) doubly linked list borrowed from linux 2.4 */ struct list_head { struct list_head *next, *prev; }; #define LIST_HEAD_INIT(name) { &(name), &(name) } #define LIST_HEAD(name) \ struct list_head name = LIST_H ...
hash.h #include <stdio.h> #define HASHSIZE 101 struct nlist { struct nlist *next; char *name; char *defn; }; unsigned hash(char *s); struct nlist *lookup(char *s); struct nlist *install(char *name, char *defn);   hash.c #include <string.h> ...

Josephus环

/************************************************************************* * 约瑟夫环问题 *n个人围成一圈,用1-n编号,从1号开始报数,报到m的人出局,下一个人从1继续 *报数,求最后出列的人的编号。 * * 解法 *(1)稍微将问题转化一下,让编号从0开始,到n-1; *(2)假设第一次报数后,s出局,则s=m%n-1,下次从k=m%n开始报数; ...

Endian Test

#include <stdio.h> static union {char c[4];unsigned long l;} endian_test={{'l','?','?','b'}}; #define ENDIANNESS ((char)endian_test.l) int checkCPU() { { union w{ int a; char b; }c; ...
#include <stdio.h> char *ops[3] = { "sum", "sub", "mul" }; int sum(int a, int b) { return a + b; } int sub(int a, int b) { return a - b; } int mul(int a, int b) { return a * b; } void show(int opnum) { pr ...
Linux: dmidecode -t 1 Windows: wmic csproduct get identifyingnumber,vendor,name
编译/etc/default/grub文件,修改内容: 找到这一行: GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” 修改为: GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash text” 然后 sudo update-grub
http://hi.baidu.com/14l0/blog/item/4d89068b99d68803b21bba20.html
  1.Qt SDK Qt SDK 在一个单独的安装程序内包括了使用 Qt 构建跨平台应用程序所需的工具。   Qt 库 4.7.0  (change notes) Qt Creator IDE 2.0.1  (change notes) Qt 开发工具(Qt Add-Ons, Qt Mobility) 2.Frameworks on top of Qt (1)Qt Mobility Qt Mobility delivers a set of APIs to Qt, with features that are well known from the mobile devi ...
  MeeGo-OS Middleware 1.Comms Services (1)Connection Mgmt---connman http://connman.net/ The ConnMan project provides a daemon for managing internet connections within embedded devices running the Linux operating system. The Connection Manager is designed to be slim and to use as few resource ...
Global site tag (gtag.js) - Google Analytics