摘要: View Code #include <stdio.h>#include <string.h>int main(){ int m, n; int k = 0; int ticket[10001]; while (scanf("%d %d", &m, &n)) { int i = 1; if (!m && !n) { break; } memset(ticket, 0, sizeof(ticket)); int tmp; for (i = 1; i <= n; i++) { scanf("%d" 阅读全文
posted @ 2011-03-26 20:18 涵曦 阅读(338) 评论(0) 推荐(0) 编辑
摘要: int with= GetSystemMetrics(SM_CXFULLSCREEN); int heigh= GetSystemMetrics(SM_CYFULLSCREEN);通过上边两个函数获取的是显示屏幕的大小,及不包括任务栏等区域。 int cx = GetSystemMetrics( SM_CXSCREEN ); int cy = GetSystemMetrics( SM_CYSCREEN );这两个函数获取的是真正屏幕的大小。用前两个函数获取的大小可能是1024*687 而用下边两个获取的就是1024*768GetWindowRect用法:GetWindowRect(HWND,. 阅读全文
posted @ 2011-03-26 16:15 涵曦 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 汉诺塔 - 解决思路1.如果只有一个金片,则把该金片从源移动到目标棒,结束。2.如果有n个金片,则把前n-1个金片移动到辅助的棒,然后把自己移动到目标棒,最后再把前n-1个移动到目标棒//Tower of Hanoi 汉诺塔#include <stdio.h>void TOH(int n, char A, char B, char C){ if (n == 1) { printf("Movedisk %d from %c to %c \n",n,A,C); return; } TOH(n-1, A, C, B); printf("Movedisk %d 阅读全文
posted @ 2011-03-24 20:36 涵曦 阅读(1961) 评论(0) 推荐(0) 编辑
摘要: 产生随机的排列: permute()函数的功能是:打乱数组的顺序 Random()函数的功能是:产生一个0 —> n-1的随机数 swap()函数的功能是:交换数组里第i个和第j个元素的值//功能:产生随机的排列#include <stdio.h>#include<stdlib.h>//声明函数void permute(int array[], int n);int Random(int n);void swap(int A[], int i, int j);//Randomly permute the n values of arrayvoid permute( 阅读全文
posted @ 2011-03-24 19:50 涵曦 阅读(447) 评论(0) 推荐(1) 编辑