摘要: It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch. Marmot brought Mole n ordered piles of worms such that i-th pile co 阅读全文
posted @ 2017-07-26 19:50 wydxry 阅读(300) 评论(0) 推荐(0) 编辑
摘要: Let's consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column contains numberi × j. The 阅读全文
posted @ 2017-07-26 19:01 wydxry 阅读(396) 评论(0) 推荐(0) 编辑
摘要: Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to pl 阅读全文
posted @ 2017-07-26 18:38 wydxry 阅读(364) 评论(0) 推荐(0) 编辑
摘要: Scrooge McDuck keeps his most treasured savings in a home safe with a combination lock. Each time he wants to put there the treasures that he's earned 阅读全文
posted @ 2017-07-26 18:08 wydxry 阅读(399) 评论(0) 推荐(0) 编辑
摘要: It's one more school day now. Sasha doesn't like classes and is always bored at them. So, each day he invents some game and plays in it alone or with 阅读全文
posted @ 2017-07-26 16:47 wydxry 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 给出2个N * N的矩阵M1和M2,输出2个矩阵相乘后的结果。 给出2个N * N的矩阵M1和M2,输出2个矩阵相乘后的结果。 Input 第1行:1个数N,表示矩阵的大小(2 <= N <= 100) 第2 - N + 1行,每行N个数,对应M1的1行(0 <= M1[i] <= 1000) 第N 阅读全文
posted @ 2017-07-26 14:56 wydxry 阅读(239) 评论(0) 推荐(0) 编辑
摘要: M * N的方格,一个机器人从左上走到右下,只能向右或向下走。有多少种不同的走法?由于方法数量可能很大,只需要输出Mod 10^9 + 7的结果。 M * N的方格,一个机器人从左上走到右下,只能向右或向下走。有多少种不同的走法?由于方法数量可能很大,只需要输出Mod 10^9 + 7的结果。 M 阅读全文
posted @ 2017-07-26 14:33 wydxry 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 一个正整数,如果它能被7整除,或者它的十进制表示法中某个位数上的数字为7,则称其为与7相关的数。求所有小于等于N的与7无关的正整数的平方和。 例如:N = 8,<= 8与7无关的数包括:1 2 3 4 5 6 8,平方和为:155。 一个正整数,如果它能被7整除,或者它的十进制表示法中某个位数上的数 阅读全文
posted @ 2017-07-26 13:59 wydxry 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 水仙花数是指一个 n 位数 ( n >= 3 ),它的每个位上的数字的 n 次幂之和等于它本身。(例如:1^3 + 5^3 + 3^3 = 153) 给出一个整数M,求 >= M的最小的水仙花数。 水仙花数是指一个 n 位数 ( n >= 3 ),它的每个位上的数字的 n 次幂之和等于它本身。(例如 阅读全文
posted @ 2017-07-26 13:37 wydxry 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 一个矩形的面积为S,已知该矩形的边长都是整数,求所有满足条件的矩形中,周长的最小值。例如:S = 24,那么有{1 24} {2 12} {3 8} {4 6}这4种矩形,其中{4 6}的周长最小,为20。 一个矩形的面积为S,已知该矩形的边长都是整数,求所有满足条件的矩形中,周长的最小值。例如:S 阅读全文
posted @ 2017-07-26 13:25 wydxry 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 1,10,100,1000...组成序列1101001000...,求这个序列的第N位是0还是1。 1,10,100,1000...组成序列1101001000...,求这个序列的第N位是0还是1。 Input 第1行:一个数T,表示后面用作输入测试的数的数量。(1 <= T <= 10000) 第 阅读全文
posted @ 2017-07-26 11:35 wydxry 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 给出一个数N,求1至N中,有多少个数不是2 3 5 7的倍数。 例如N = 10,只有1不是2 3 5 7的倍数。 给出一个数N,求1至N中,有多少个数不是2 3 5 7的倍数。 例如N = 10,只有1不是2 3 5 7的倍数。 给出一个数N,求1至N中,有多少个数不是2 3 5 7的倍数。 例如 阅读全文
posted @ 2017-07-26 10:59 wydxry 阅读(333) 评论(0) 推荐(0) 编辑
摘要: 给出一个整数N,输出N^N(N的N次方)的十进制表示的末位数字。 给出一个整数N,输出N^N(N的N次方)的十进制表示的末位数字。 给出一个整数N,输出N^N(N的N次方)的十进制表示的末位数字。 Input 一个数N(1 <= N <= 10^9) Output 输出N^N的末位数字 Input示 阅读全文
posted @ 2017-07-26 10:39 wydxry 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 给出一个字符串S(可能有重复的字符),按照字典序从小到大,输出S包括的字符组成的所有排列。例如:S = "1312", 输出为: 1123 1132 1213 1231 1312 1321 2113 2131 2311 3112 3121 3211 给出一个字符串S(可能有重复的字符),按照字典序从 阅读全文
posted @ 2017-07-26 10:29 wydxry 阅读(280) 评论(0) 推荐(0) 编辑
摘要: n的阶乘后面有多少个0? 6的阶乘 = 1*2*3*4*5*6 = 720,720后面有1个0。 n的阶乘后面有多少个0? 6的阶乘 = 1*2*3*4*5*6 = 720,720后面有1个0。 n的阶乘后面有多少个0? 6的阶乘 = 1*2*3*4*5*6 = 720,720后面有1个0。 6的阶 阅读全文
posted @ 2017-07-26 10:15 wydxry 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 给出两个字符串A B,求A与B的最长公共子序列(子序列不要求是连续的)。 比如两个串为: abcicba abdkscab ab是两个串的子序列,abc也是,abca也是,其中abca是这两个字符串最长的子序列。 给出两个字符串A B,求A与B的最长公共子序列(子序列不要求是连续的)。 比如两个串为 阅读全文
posted @ 2017-07-26 10:08 wydxry 阅读(290) 评论(0) 推荐(0) 编辑
摘要: We are all familiar with sorting algorithms: quick sort, merge sort, heap sort, insertion sort, selection sort, bubble sort, etc. But sometimes it is 阅读全文
posted @ 2017-07-26 09:37 wydxry 阅读(239) 评论(0) 推荐(0) 编辑
摘要: A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence ( a1, a2, ..., aN) be any sequence ( ai1, 阅读全文
posted @ 2017-07-26 09:34 wydxry 阅读(182) 评论(0) 推荐(0) 编辑
摘要: A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = <x1, x2, ..., xm> another se 阅读全文
posted @ 2017-07-26 09:32 wydxry 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 编辑距离,又称Levenshtein距离(也叫做Edit Distance),是指两个字串之间,由一个转成另一个所需的最少编辑操作次数。许可的编辑操作包括将一个字符替换成另一个字符,插入一个字符,删除一个字符。 例如将kitten一字转成sitting: sitten (k->s) sittin ( 阅读全文
posted @ 2017-07-26 09:09 wydxry 阅读(307) 评论(0) 推荐(0) 编辑
Live2D