摘要:
将1,2,...,9共9个数排成下列形态的三角形。 a b c d e f g h i 其中:a~i分别表示1,2,...,9中的一个数字,并要求同时满足下列条件: (1)a<f<i; (2)b<d, g<h, c<e (3)a+b+d+f=f+g+h+i=i+e+c+a=P 程序要求:根据输入的边 阅读全文
摘要:
斐波那契数列的定义如下: F(0) = 0 F(1) = 1 F(n) = F(n - 1) + F(n - 2) (n >= 2) (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, ...) 给出n,求F(n),由于结果很大,输出F(n) 阅读全文
摘要:
一、插入排序-直接插入排序(Straight Insertion Sort) 直接插入排序(Straight Insertion Sort)的基本思想是:把n个待排序的元素看成为一个有序表和一个无序表。开始时有序表中只包含1个元素,无序表中包含有n-1个元素,排序过程中每次从无序表中取出第一个元素, 阅读全文
摘要:
B. Balanced Substring You are given a string s consisting only of characters 0 and 1. A substring [l, r] of s is a string slsl + 1sl + 2... sr, and it 阅读全文
摘要:
定义一个结构体链表存储某班级学生的学号、姓名和三门课程的成绩,实现增加、修改、删除和查询记录的功能。(每次只有一次操作) 阅读全文
摘要:
B. Ordering Pizza It's another Start[c]up finals, and that means there is pizza to order for the onsite contestants. There are only 2 types of pizza ( 阅读全文
摘要:
F. Cities Excursions F. Cities Excursions There are n cities in Berland. Some pairs of them are connected with m directed roads. One can use only thes 阅读全文
摘要:
在有向图中,若两点至少包含一条路径可以到达,则称两个顶点强连通,若任意两个顶点皆如此,则称此图为强联通图。非强连通图有向图的极大强连通子图,称为强连通分量(strongly connected components)。 中间查找过程类似于深度优先搜索和并查集。 代码实现: 阅读全文
摘要:
E. Fire http://codeforces.com/problemset/problem/864/E Polycarp is in really serious trouble — his house is on fire! It's time to save the most valuab 阅读全文
摘要:
gym 101192 F. Stone, grass and fire http://codeforces.com/gym/101192/problem/F Farmer Lyosha owns a rectangular field. The field has n rows and m colu 阅读全文