生活
默闻革
这个作者很懒,什么都没留下…
展开
-
智力测试
1.有A、B、C、D四个人,要在夜里过一座桥。他们通过这座桥分别需要耗时1、2、5、10分钟,只有一支手电,并且同时最多只能两个人一起过桥。请问,如何安排,能够在17分钟内这四个人都过桥? 第一步:A(1)和B(2)过桥,A(1)返回 Cost:1+2 第二步: C(5)和D(10)过桥,B(2)返回 Cost:10+2 第三步: A(1)和B(2)过桥 Cost:2 2.原创 2013-12-06 22:15:56 · 870 阅读 · 0 评论 -
矩阵乘法
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplicationDemo { class Program { static void Main(string[] args) {原创 2014-01-06 19:00:34 · 549 阅读 · 0 评论 -
1323:算法2-1:集合union
题目描述 假设利用两个线性表LA和LB分别表示两个集合A和B(即:线性表中的数据元素即为集合中的成员),现要求一个新的集合A=A∪B。这就要求对线性表做如下操作:扩大线性表LA,将存在于线性表LB中而不存在于线性表LA中的数据元素插入到线性表LA中去。只要从线性表LB中依次取得每个元素,并依值在线性表LA中进行查访,若不存在,则插入之。上述操作过程可用下列算法描述之。 图:将两原创 2014-03-12 10:17:36 · 1224 阅读 · 0 评论 -
最大公约数
#include int fun(int a,int b) { int r; while((r=b%a)!=0) { b=a; a=r; } return a; } int main() { int n,max,min,temp,count=0; while(scanf("%d",&n)!=EOF) { while(n--) {原创 2014-03-12 10:25:58 · 450 阅读 · 0 评论