摘要: 分三块来讲述:1 首先:在C中定义一个结构体类型要用typedef:typedef struct Student{int a;}Stu;于是在声明变量的时候就可:Stu stu1;如果没有typedef就必须用struct Student stu1;来声明这里的Stu实际上就是struct Student的别名。另外这里也可以不写Student(于是也不能struct Student stu1;了... 阅读全文
posted @ 2010-03-04 23:02 Woody Wu 阅读(272) 评论(0) 推荐(0) 编辑
摘要: Joseph Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 26955 Accepted: 10073 Description The Joseph's problem is notoriously known. For those who are not familiar with the original prob... 阅读全文
posted @ 2010-02-10 23:29 Woody Wu 阅读(323) 评论(0) 推荐(0) 编辑
摘要: System Overload Time Limit: 10 Seconds Memory Limit: 32768 KB Recently you must have experienced that when too many people use the BBS simultaneously, the net becomes very, very slow.To put an end t... 阅读全文
posted @ 2010-02-10 00:02 Woody Wu 阅读(637) 评论(2) 推荐(0) 编辑
摘要: 破译密码Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1772 Accepted: 1111Description据说最早的密码来自于罗马的凯撒大帝。消息加密的办法是:对消息原文中的每个字母,分别用该字母之后的第5个字母替换(例如:消息原文中的每个字母A都分别替换成字母F)。而你要获得消息原文,也就是要将这个过程反过来。密码... 阅读全文
posted @ 2010-01-28 17:08 Woody Wu 阅读(736) 评论(0) 推荐(0) 编辑
摘要: 自己写来玩的,觉得记下来还是有点意义的,呵呵:SudukuGameCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1//--------------------------------//2//作者:不喝橙汁3//完成日期:09.12.304//---... 阅读全文
posted @ 2010-01-07 19:19 Woody Wu 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 编写一个函数,该函数具有两个形参,分别为int型和指向Int型的指针,并返回这两个int值之中较大的数值.考虑应将其指针形参定义为什么类型?#include <iostream>using namespace std;int max(const int &x,const int* &y){return x>= *y ?x: *y;}void main( ){int v1=90;int v2=20;int* v3=&v2;cout<<max(v1,v3);}//OR#include <iostream>using namespac 阅读全文
posted @ 2009-07-11 20:07 Woody Wu 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 1、欧几里德算法和扩展欧几里德算法 欧几里德算法 欧几里德算法又称辗转相除法,用于计算两个整数a,b的最大公约数。其计算原理依赖于下面的定理: 定理:gcd(a,b) = gcd(b,a mod b) 证明:a可以表示成a = kb + r,则r = a mod b 假设d是a,b的一个公约数,则有 d|a, ... 阅读全文
posted @ 2009-07-06 20:17 Woody Wu 阅读(162) 评论(0) 推荐(0) 编辑
摘要: ①----------------------------------------------------------------------------------------------------------------------------------------------------马宁德拉·阿格拉瓦(附:素数判定算法(当且仅当n为素数时,最终输出数才为素数)) lnput: integer n>1 1.if (n is of the form a^b, b>1)output COMPOSITE; 2.R=2 3.while (r<n) { 4. if 阅读全文
posted @ 2009-07-06 19:55 Woody Wu 阅读(336) 评论(0) 推荐(0) 编辑