摘要: Description Windy has N balls of distinct weights from 1 unit to N units. Now he tries to label them with 1 to N in such a way that: No two balls shar 阅读全文
posted @ 2019-07-11 21:08 hbhdhd 阅读(101) 评论(0) 推荐(0) 编辑
摘要: https://vjudge.net/problem/CodeForces-1133C 题意:在数组中找出一段 每两个元素差值不大于5的这段元素个数的最大值。 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #includ 阅读全文
posted @ 2019-05-18 22:33 hbhdhd 阅读(223) 评论(0) 推荐(0) 编辑
摘要: An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the 阅读全文
posted @ 2019-05-13 21:17 hbhdhd 阅读(546) 评论(0) 推荐(0) 编辑
摘要: You are given two strings ss and tt, both consisting of exactly kk lowercase Latin letters, ss is lexicographically less than tt. Let's consider list 阅读全文
posted @ 2019-05-09 21:43 hbhdhd 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图2就不是同构的。 图1 图2 现给定两棵树,请你判断它们是否是同构的。 输入格式: 输入给出2棵 阅读全文
posted @ 2019-05-03 17:49 hbhdhd 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 9 #define OK 1 10 #define ERROR 0 11 #define MAXSIZE 100 12 13 using namespace std; 14 15 int main() 16 { 1... 阅读全文
posted @ 2019-04-25 20:27 hbhdhd 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 提示:一个显然的办法是逐渐增加光棍的位数,直到可以整除x为止。但难点在于,s可能是个非常大的数 —— 比如,程序输入31,那么就输出3584229390681和15,因为31乘以3584229390681的结果是111111111111111,一共15个1。 输入格式: 输入在一行中给出一个不以5结 阅读全文
posted @ 2019-03-26 22:35 hbhdhd 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 天梯图书阅览室请你编写一个简单的图书借阅统计程序。当读者借书时,管理员输入书号并按下S键,程序开始计时;当读者还书时,管理员输入书号并按下E键,程序结束计时。书号为不超过1000的正整数。当管理员将0作为书号输入时,表示一天工作结束,你的程序应输出当天的读者借书次数和平均阅读时间。 注意:由于线路偶 阅读全文
posted @ 2019-03-25 20:46 hbhdhd 阅读(175) 评论(0) 推荐(0) 编辑
摘要: L1-039 古风排版 (20 分) 中国的古人写文字,是从右向左竖向排版的。本题就请你编写程序,把一段文字按古风排版。 输入格式: 输入在第一行给出一个正整数N(<100),是每一列的字符数。第二行给出一个长度不超过1000的非空字符串,以回车结束。 输出格式: 按古风格式排版给定的字符串,每列N 阅读全文
posted @ 2019-03-21 09:22 hbhdhd 阅读(345) 评论(0) 推荐(0) 编辑
摘要: 本题的要求很简单,就是求N个数字的和。麻烦的是,这些数字是以有理数分子/分母的形式给出的,你输出的和也必须是有理数的形式。 输入格式: 输入第一行给出一个正整数N(≤100)。随后一行按格式a1/b1 a2/b2 ...给出N个有理数。题目保证所有分子和分母都在长整型范围内。另外,负数的符号一定出现 阅读全文
posted @ 2019-03-13 15:52 hbhdhd 阅读(625) 评论(0) 推荐(0) 编辑