摘要: 题目描述 We have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the larges 阅读全文
posted @ 2018-07-16 17:22 RhythmLian 阅读(259) 评论(0) 推荐(0)
摘要: 题目描述 People are different. Some secretly read magazines full of interesting girls' pictures, others create an A-bomb in their cellar, others like usin 阅读全文
posted @ 2018-07-16 17:15 RhythmLian 阅读(183) 评论(0) 推荐(0)
摘要: 题目描述 给定一张 n(n≤20) 个点的带权无向图,点从 0~n-1 标号,求起点 0 到终点 n-1 的最短Hamilton路径。 Hamilton路径的定义是从 0 到 n-1 不重不漏地经过每个点恰好一次 输入 第一行一个整数n。接下来n行每行n个整数,其中第i行第j个整数表示点i到j的距离 阅读全文
posted @ 2018-07-16 17:12 RhythmLian 阅读(1079) 评论(0) 推荐(0)
摘要: 题目描述 求 a 乘 b 对 p 取模的值,其中 1≤a,b,p≤10^18。 输入 第一行a,第二行b,第三行p。 输出 一个整数,表示a*b mod p的值。 样例输入 2 3 9 样例输出 6 #include <iostream> #include <string> #include <cs 阅读全文
posted @ 2018-07-16 16:49 RhythmLian 阅读(182) 评论(0) 推荐(0)
摘要: 题目描述 求 a 的 b 次方对 p 取模的值,其中 1≤a,b,p≤10^9 输入 三个用空格隔开的整数a,b和p。 输出 一个整数,表示a^b mod p的值。 样例输入 2 3 9 样例输出 8 #include <iostream> #include <string> #include <c 阅读全文
posted @ 2018-07-16 16:45 RhythmLian 阅读(275) 评论(0) 推荐(0)
摘要: 题目描述 Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located withi 阅读全文
posted @ 2018-07-16 16:42 RhythmLian 阅读(200) 评论(0) 推荐(0)
摘要: 题目描述 从 1~n 这 n 个整数中随机选出 m 个,输出所有可能的选择方案。n>0, 0<=m<=n, n+(n-m)<=25。 输入 一个整数n。 输出 按照从小到大的顺序输出所有方案,每行1个。首先,同一行内的数升序排列,相邻两个数用一个空格隔开。其次,对于两个不同的行,对应下标的数一一比较 阅读全文
posted @ 2018-07-16 16:08 RhythmLian 阅读(758) 评论(0) 推荐(1)
摘要: 题目描述 FJ's N (1 ≤ N ≤ 10,000) cows conveniently indexed 1..N are standing in a line. Each cow has a positive integer height (which is a bit of secret). 阅读全文
posted @ 2018-07-16 15:31 RhythmLian 阅读(208) 评论(0) 推荐(0)
摘要: 题目描述 一种新型的激光炸弹,可以摧毁一个边长为R的正方形内的所有的目标。现在地图上有n(n≤10000)个目标,用整数xi,yi(0≤xi,yi≤5000)表示目标在地图上的位置,每个目标都有一个价值0<vi<100。激光炸弹的投放是通过卫星定位的,但其有一个缺点,就是其爆破范围,即那个边长为R的 阅读全文
posted @ 2018-07-16 15:14 RhythmLian 阅读(201) 评论(0) 推荐(0)
摘要: 题目描述 你玩过“拉灯”游戏吗?25盏灯排成一个5x5的方形。每一个灯都有一个开关,游戏者可以改变它的状态。每一步,游戏者可以改变某一个灯的状态。游戏者改变一个灯的状态会产生连锁反应:和这个灯上下左右相邻的灯也要相应地改变其状态。我们用数字“1”表示一盏开着的灯,用数字“0”表示关着的灯。下面这种状 阅读全文
posted @ 2018-07-16 14:42 RhythmLian 阅读(306) 评论(0) 推荐(0)