思维
SlienceAccept
「箴言4:23」 你要保守你心,胜过保守一切,因为一生的果效,是由心发出。
展开
-
阶乘因式分解(一)
题目链接 描述给定两个数m,n,其中m是一个素数。将n(0<=n<=10000)的阶乘分解质因数,求其中有多少个m。输入 第一行是一个整数s(0<s<=100),表示测试数据的组数 随后的s行, 每行有两个整数n,m。 输出 输出m的个数。 样例输入2100 516 2样例输出2415解题思路: 在一个数n的范围内,用n/m来表示这个范围有几个m的倍原创 2018-04-02 13:05:08 · 124 阅读 · 0 评论 -
Postman
题目链接N letters have just arrived at the post office positioned at x = 0, and the i-th letter should be posted to position x = ai. BaoBao, our beloved postman, will start his work from the post office ...原创 2019-04-19 17:48:45 · 297 阅读 · 0 评论 -
I. Distance
题目链接There are n points on a horizontal line, labelled with 1 through n from left to right.The distance between the i-th point and the (i+1)-th point is ai.For each integer k ranged from 1 to n, you...原创 2019-04-19 17:36:58 · 1589 阅读 · 0 评论 -
C. Equal Sums
题目链接You are given k sequences of integers. The length of the i-th sequence equals to ni.You have to choose exactly two sequences i and j (i≠j) such that you can remove exactly one element in each of...原创 2019-04-25 08:44:18 · 304 阅读 · 0 评论 -
D. Vasya and Arrays
题目链接Vasya has two arrays A and B of lengths n and m, respectively.He can perform the following operation arbitrary number of times (possibly zero): he takes some consecutive subsegment of the array ...原创 2019-04-19 17:31:44 · 362 阅读 · 0 评论 -
问题 D: Bits Reverse
题目链接题目描述Now given two integers x and y, you can reverse every consecutive three bits in arbitrary number’s binary form (any leading zero can be taken into account) using one coin. Reversing (1,2,3) ...原创 2019-05-06 09:13:24 · 557 阅读 · 1 评论 -
B. Expansion coefficient of the array
题目链接Let’s call an array of non-negative integers a1,a2,…,an a k-extension for some non-negative integer k if for all possible pairs of indices 1≤i,j≤n the inequality k⋅|i−j|≤min(ai,aj) is satisfied. ...原创 2019-05-14 12:14:31 · 686 阅读 · 0 评论 -
B. Hate "A"
题目链接Bob has a string s consisting of lowercase English letters. He defines s′ to be the string after removing all “a” characters from s (keeping all other characters in the same order). He then gener...原创 2019-05-14 12:17:19 · 501 阅读 · 0 评论 -
Potion
题目链接BaoBao is brewing a magical potion. To brew this potion, n types of ingredients, whose rank ranges from 1 to n, is needed. More precisely, for all 1 <= i <= n, BaoBao needs at least ai pi...原创 2019-04-19 17:50:22 · 324 阅读 · 0 评论 -
B. Alyona and a Narrow Fridge
题目链接Alyona has recently bought a miniature fridge that can be represented as a matrix with h rows and 2 columns. Initially there is only one shelf at the bottom of the fridge, but Alyona can install ...原创 2019-04-07 19:46:23 · 688 阅读 · 1 评论 -
company[山东省第八届ACM大学生程序设计竞赛]
题目链接 Problem DescriptionThere are n kinds of goods in the company, with each of them has a inventory of and direct unit benefit . Now you find due to price changes, for any goods sold on day i, if...原创 2018-04-14 16:11:51 · 273 阅读 · 0 评论 -
矩阵输出
题目链接 Problem Description输入n个整数,输出由这些整数组成的n行矩阵。 Input第一行输入一个正整数N(N<=20),表示后面要输入的整数个数。 下面依次输入N个整数。 Output以输入的整数为基础,输出有规律的n行数据。 Sample Input5 3 6 2 5 8 Sample Output3 6 2 5 8 8 3 6 2...原创 2018-04-13 21:13:12 · 1638 阅读 · 0 评论 -
多项式求和
题目链接 Problem Description 多项式描述如下: 1 - 1/2 + 1/3 - 1/4 + 1/5 - 1/6 …… 先请你求出多项式前n项的和。 Input 第一行输入一个数T代表测试数据个数(T<=1000)。接下来T行每行1个数代表n(0<=n< 2^31)。 Output 对于每个输入样例,输出多项式和的结果(结果精确到小数点后两位)。每行输出一个结果原创 2017-08-22 15:02:41 · 925 阅读 · 0 评论 -
一只小蜜蜂...
题目链接 Problem Description 有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行。请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数。 其中,蜂房的结构如下所示。 Input 输入数据的第一行是一个整数N, 表示测试实例的个数,然后是N 行数据,每行包含两个整数a和b(0<a<b<50) Output 对于每个测试实例,请输出蜜蜂从蜂房a爬到...原创 2017-07-29 11:10:26 · 253 阅读 · 0 评论 -
悼念512汶川大地震遇难同胞——重建希望小学
Problem Description 下面是512汶川大地震部分受灾学校伤亡情况(惨痛!!)1、 四川省都江堰市 聚源中学 伤亡情况:遇难学生人数(含失踪)320 详细说明: 一栋教学楼被震垮,该楼18个班420多名学生被埋,截至目前仅有不到100名获救。 2、 四川省绵阳市 北川县北川中学 伤亡情况:遇难学生人数(含失踪)1200多人 详细说明:学校教室损毁情况严重,六至七层高...原创 2017-07-28 23:51:45 · 850 阅读 · 0 评论 -
C. Ehab and a 2-operation task
题目链接You’re given an array a of length n. You can perform the following operations on it:choose an index i (1≤i≤n), an integer x (0≤x≤106), and replace aj with aj+x for all (1≤j≤i), which means add x...原创 2019-04-07 08:11:08 · 247 阅读 · 0 评论 -
A. Mahmoud and Longest Uncommon Subsequence
题目链接While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two st...原创 2019-04-07 08:46:57 · 186 阅读 · 0 评论 -
B. Divisors of Two Integers
题目链接Recently you have received two positive integer numbers x and y. You forgot them, but you remembered a shuffled list containing all divisors of x (including 1 and x) and all divisors of y (includ...原创 2019-04-07 09:34:32 · 398 阅读 · 0 评论