![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
寒假算法训练1
yuson_g
这个作者很懒,什么都没留下…
展开
-
寒假算法训练1-J(分棍子,求最长棍子的数量,另外学习map的排序方法)
有一根粗细均匀长度为 LL 的木棍,先用红颜色刻度线将它 m 等分,再用蓝色刻度线将其 n 等分(m>n),然后按所有刻度线将该木棍锯成小段,计算并输出长度最长的木棍的长度和棍数。例如:木棍长12,按照6,4划分。最长的木棍长度为2。共有4根。Input输入仅有一行,包含三个正整数 L,m 和 n,两两之间用一个空格分隔。(1≤L≤100000)Output输出包含两个正整数 a 和 k,分别表示最长木棍的长度和根数。(为了简化题目的难度,所有的测试数据中 m 和 n 一定是 L 的约数)。原创 2021-03-01 09:35:50 · 511 阅读 · 0 评论 -
寒假算法训练1-D(快速幂,欧拉函数的简单使用)
Give a number n, find the minimum x(x>0) that satisfies 2^x mod n = 1.InputOne positive integer on each line, the value of n.OutputIf the minimum x exists, print a line with 2^x mod n = 1.Print 2^? mod n = 1 otherwise.You should replace x and n wi原创 2021-03-01 10:22:44 · 111 阅读 · 0 评论 -
寒假算法训练1-H(已知猜的次数求猜测最大数)
A有1数m,B来猜.B每猜一次,A就说"太大",“太小"或"对了” 。问B猜n次可以猜到的最大数。Input第1行是整数T,表示有T组数据,下面有T行每行一个整数n (1 ≤ n ≤ 30)Output猜n次可以猜到的最大数Sample Input213Sample Output17...原创 2021-03-01 08:52:50 · 95 阅读 · 0 评论 -
寒假算法训练1-C(快速判断一个数是否是2的n次方)
数论中有许多猜想尚未解决,其中有一个被称为“角谷猜想”的问题,该问题在五、六十年代的美国多个著名高校中曾风行一时,这个问题是这样描述的:任何一个大于一的自然数,如果是奇数,则乘以三再加一;如果是偶数,则除以二;得出的结果继续按照前面的规则进行运算,最后必定得到一。现在请你编写一个程序验证他的正确性。Input本题有多个测试数据组,第一行为测试数据组数N,接着是N行的正整数。Output输出验证“角谷猜想”过程中的奇数,最后得到的1不用输出;每个测试题输出一行;每行中只有两个输出之间才能有一个空格;如原创 2021-02-28 00:47:28 · 110 阅读 · 0 评论 -
寒假算法训练1-A(stl中map的简单使用)
Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges’ favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result.This原创 2021-02-27 19:36:55 · 137 阅读 · 0 评论