- 博客(48)
- 收藏
- 关注
原创 Robot Motion
A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are N north (up the pa...
2018-07-31 22:22:53 194
原创 Catch That Cow
农夫知道一头牛的位置,想要抓住它。农夫和牛都于数轴上 ,农夫起始位于点 N(0<=N<=100000) ,牛位于点 K(0<=K<=100000) 。农夫有两种移动方式: 1、从 X移动到 X-1或X+1 ,每次移动花费一分钟 2、从 X移动到 2*X ,每次移动花费一分钟 假设牛没有意识到农夫的行动,站在原地不。最少要花多少时间才能抓住牛? Input 一行: 以空格...
2018-07-31 22:15:44 5467
原创 Battle City
Many of us had played the game “Battle city” in our childhood, and some people (like me) even often play it on computer now. What we are discussing is a simple edition of this game. Given a map that...
2018-07-31 22:12:46 185
原创 Rescue
Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs, ROADs, and GUARDs in the prison. Angel’s friends want t...
2018-07-31 22:09:32 230
原创 台阶问题
题目描述 有 N 级的台阶,你一开始在底部,每次可以向上迈最多 K 级台阶(最少 1 级),问到达第 N 级台阶有多少种不同方式。 输入 多组输入,两个正整数N(N ≤ 1000),K(K ≤ 100)。 输出 一个正整数,为不同方式数,由于答案可能很大,你需要输出 ans mod 100003 后的结果。 样例输入 5 2 样例输出 8 N=1:根据显然定理,只有1种走法 ...
2018-07-30 15:36:45 4074
原创 又是划分问题
题目描述 给你一个正整数n,将其划分,要求划分成的数必须是2的幂,有多少种划分方法?? 结果可能很大,我们输出对1e9+7取模的结果 输入 一个正整数n,代表要划分的数; 1<=n<=1e7 输出 输出可划分的方法数 样例输入 15 67 样例输出 26 2030 提示 当n=6时,我们可以将其划分为 1 1 1 1 1 1 1 1 1 1 2 1 ...
2018-07-30 15:04:51 117
原创 zz’s math problem Ⅰ
题目描述 有些人心如花木,皆向阳而生 ————《剑来》 zz很喜欢数学,但是他又是一个数学渣,我们称这种生物叫做学渣, zz又碰到了一个数学小问题,定义一个函数P (x) 例如:P (123) = 1! ∗ 2! ∗ 3! 现在需要找到的就是最大的大于等于x大的数z的函数值和x相等, 即P...
2018-07-30 11:31:10 142
原创 又是斐波那契数列??
大家都知道斐波那契数列吧?斐波那契数列的定义是这样的: f0 = 0; f1 = 1; fi = fi-1 + fi-2现在给你一个数x,聪明的你一定知道这是斐波那契数列中的第几项。 (数据保证x一定有对应的项y,且 2 <= y < 1e4)输入 第一行一个整数T,表示测试组数。 之后的T行,每行一个数x 输出 对于每个测试数据,输出一行表示数x是第几项 样例...
2018-07-30 10:52:46 254
原创 Smith Numbers POJ - 1142
While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property: ...
2018-07-29 09:44:52 109
原创 A Sweet Journey
Master Di plans to take his girlfriend for a travel by bike. Their journey, which can be seen as a line segment of length L, is a road of swamps and flats. In the swamp, it takes A point strengths per...
2018-07-28 20:30:08 309
原创 Trailing Zeroes (III)
You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*...*N. For example, 5! = 120, 120 contains one zero on the tra...
2018-07-28 20:29:12 138
原创 They Are Everywhere
They Are Everywhere Sergei B., the young coach of Pokemons, has found the big house which consists of nflats ordered in a row from left to right. It is possible to enter each flat from the street....
2018-07-28 20:28:17 393
原创 A - Stages
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be des...
2018-07-28 12:07:40 300
原创 Cows
Your friend to the south is interested in building fences and turning plowshares into swords. In order to help with his overseas adventure, they are forced to save money on buying fence posts by using...
2018-07-26 20:43:18 301
原创 F - Large Division LightOJ - 1214
iven two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer c such that a = b * c.I...
2018-07-26 20:42:52 98
原创 E - Integer Divisibility LightOJ - 1078
If an integer is not divisible by 2 or 5, some multiple of that number in decimal notation is a sequence of only a digit. Now you are given the number and the only allowable digit, you should report t...
2018-07-26 20:42:11 71
原创 51nod 1013
求:3^0 + 3^1 +...+ 3^(N) mod 1000000007Input输入一个数N(0 <= N <= 10^9)Output输出:计算结果Sample Input3Sample Output40// 视为等比数列 和为 (1 - q^n)/(1-q) 在本题中 (3^n - 1)/2mod 1000000007//A/B%m...
2018-07-26 20:40:54 155
原创 51 nod 2516
给出2个数M和N(M < N),且M与N互质,找出一个数K满足0 < K < N且K * M % N = 1,如果有多个满足条件的,输出最小的。Input输入2个数M, N中间用空格分隔(1 <= M < N <= 10^9)Output输出一个数K,满足0 < K < N且K * M % N = 1,如果有多个满足条件的,输出最小的...
2018-07-26 20:39:52 108
原创 hdu 1576
要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。Input数据的第一行是一个T,表示有T组数据。 每组数据有两个数n(0 <= n < 9973)和B(1 <= B <= 10^9)。Output对应每组数据输出(A/B)%9973。Sample Input2...
2018-07-26 20:38:45 84
原创 Area
Being well known for its highly innovative products, Merck would definitely be a good target for industrial espionage. To protect its brand-new research and development facility the company has instal...
2018-07-26 20:28:45 135
原创 X and Y
题目描述 已知:y1 = k·x1 y2 = k·x2 z = min{y1·y2 k2 } y1, y2, k, x1, x2 ∈ Z+ 给定 y1,y2 求 z 输入 多组输入,每行输入两个数字:y1,y2,请求到文件结束(EOF) 0 &lt; y1,y2 &lt; 231 输出 每行输出一个整数 z ,最后一组输出数据末尾没有换行符 输入样例 3 2 3 5 2...
2018-07-23 16:40:10 139
原创 又是毕业季 (我是找的规律)
题目描述 为了把毕业晚会办得更好,老师想要挑出默契程度最大的k个人参与毕业晚会彩排。可是如何挑 呢?老师列出全班同学的号数1,2,……,n,并且相信k个人的默契程度便是他们的最大公约数 (这不是迷信哦 )。这可难为了他,请你帮帮忙吧! PS:一个数的最大公约数即本身。 输入 多组输入,两个空格分开的正整数n和k。(n大于等于k,k大于等于1) 输出 一个整数,为最大的默契值。 输入样例...
2018-07-23 16:28:35 97
原创 Pair and Straight
题目描述 人生当苦无妨,良人当归即好。 —《雪中悍刀行》 我们现在有很多很多很多数字,现在我们想知道这些数字里面有最多有多少个 P 与 S。 我们定义 P的含义为大小相同的两个数字的个数,例如一组数字里面有两个1 那么这两个1就 是一个P,四个1,那么就是2个P。 S的含义为连续的是三个数字,例如1,2,3就是一个S。 还请acmer 请将可以得到的最多的P与S输出 输入 第1行输入T(...
2018-07-23 16:19:43 119
原创 NHK协会的阴谋 (大水题!!!)
比赛的时候因为题目太长就没有认真看!!! 题目描述 “阴谋啊,这一定是NHK协会的阴谋” 事实上,NHK协会是真实存在的,NHK协会会为每个人分配一个特征码(只包含大写字母的 字符串)以及一个改变系数Q。然后NHK协会会根据以下规则将满足条件的人列为NEET:规定特 征码中所有的0N0,0H0,0K0最多能组合成”NHK”的个数为P 。要求1.P &gt; K 2.Q &lt; L; K,L是...
2018-07-23 15:58:48 319
原创 辞树的QAQ水题 (前缀和乘积)
题目描述 蒟蒻的辞树又被吊打了嘤嘤嘤。留下了属于弱者的眼泪QAQAQAQAQAAQAAQA······ 现在我 们定义辞树的悲伤值 F 。F的值为主串中子序列为”QAQ”的个数。注意字母“QAQ”不一定是 连续的,但是字母的顺序应该是准确的。 输入 输入一个整数T(0 ≤ T ≤ 20),代表有T组数据。每组数据会给出一个字符串S,长度为len,0 &lt; len ≤ 1000000 输出 ...
2018-07-23 15:22:58 210
原创 Ananagrams
Most crossword puzzle fans are used to anagrams — groups of words with the same letters in different orders — for example OPTS, SPOT, STOP, POTS and POST. Some words however do not have this attribute...
2018-07-21 22:58:34 587
原创 Three Parts of the Array
You are given an array d1,d2,…,dn consisting of n integer numbers.Your task is to split this array into three parts (some of which may be empty) in such a way that each element of the array belongs ...
2018-07-21 21:52:28 387
原创 A and B and Compilation Errors
A和B正在准备即将到来的信息学全国联赛。B非常喜欢写程序。写完程序以后,他必须先编译代码。最初,编译器显示有Ñ个编译错误,其中每一个被表示为一个正整数。经过一番努力,B设法解决一个错误,然后又编译了下,又改正了一个错误。B可以完全肯定,他纠正了两个错误,但他忘记了是哪几个编译错误消失了。 你能帮助B来找出那两个已经被改正的错误么? Input 输入的第一行包含整数n(3≤n≤1...
2018-07-21 21:47:58 164
原创 不重复数字
给出N个数,要求把其中重复的去掉,只保留第一次出现的数。 例如,给出的数为1 2 18 3 3 19 2 3 6 5 4,其中2和3有重复,去除后的结果为1 2 18 3 19 6 5 4。Input 输入第一行为正整数T,表示有T组数据。 接下来每组数据包括两行,第一行为正整数N,表示有N个数。第二行为要去重的N个正整数。Output对于每组数据,输出一行,为去重后剩下的数字,...
2018-07-21 21:45:21 1131
原创 统计难题
Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符串. ...
2018-07-21 21:42:30 176
原创 Let the Balloon Rise
Description 在ACM比赛中,你每解决一道题,你就可以获得一个气球,不同颜色的气球代表你解决了不同的问题。在WJL同学参加的一场ACM比赛中,他发现场面上有N个气球,并熟练的说出了气球的颜色。请你编写一个程序,找出气球数量最多的颜色。 Input 有多组样例输入。每组样例第一行输入一个整数N (0 < N <= 1000) ,代表一共有N个气球。若N=0,则代表...
2018-07-21 21:37:53 136
原创 水果
夏天来了好开心啊,呵呵,好多好多水果 Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了. Input 第一行正整数N(0#include<cstdio>#include<map>#include<iostream>#include<...
2018-07-21 21:34:36 332 1
原创 {A} + {B}
给你两个集合,要求{A} + {B}. 注:同一个集合中不会有两个相同的元素. Input 每组输入数据分为三行,第一行有两个数字n,m(0#include<cstdio>#include<set>#include<iostream>using namespace std;int main(){ int n, m, x; ...
2018-07-21 21:31:31 1145
原创 Andy's First Dictionary
Description XY学长刚刚立下了再不过CET就直播xx的flag,为了不真的开启直播模式,XY学长决定好好学习英语。于是他每天都读一篇只包含生词的英语文章,并以自己高达450的智商在一秒钟之内记忆下来。现在给你一篇XY学长今天要读的文章,请你写一个程序,输出他都学习到了哪些单词。 要求:如果文章中有相同的单词,那么仅仅输出一次;而且如果两个单词只有大小写不同,将他们视为相同的单词...
2018-07-21 21:27:51 176
转载 算法的时间复杂度和空间复杂度-总结
算法的时间复杂度和空间复杂度-总结 通常,对于一个给定的算法,我们要做 两项分析。第一是从数学上证明算法的正确性,这一步主要用到形式化证明的方法及相关推理模式,如循环不变式、数学归纳法等。而在证明算法是正确的基础上,第二部就是分析算法的时间复杂度。算法的时间复杂度反映了程序执行时间随输入规模增长而增长的量级,在很大程度上能很好反映出算法的优劣与否。因此,作为程序员,掌握基本的算法...
2018-07-21 09:39:08 131
原创 B
Excel可以对一组纪录按任意指定列排序。现请你编写程序实现类似功能。Input测试输入包含若干测试用例。每个测试用例的第1行包含两个整数 N (<=100000) 和 C,其中 N 是纪录的条数,C 是指定排序的列号。以下有 N 行,每行包含一条学生纪录。每条学生纪录由学号(6位数字,同组测试中没有重复的学号)、姓名(不超过8位且不包含空格的字符串)、成绩(闭区间[0, 100]...
2018-07-20 15:08:56 67
原创 F
“Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used...
2018-07-20 15:07:37 80
原创 A
每天第一个到机房的人要把门打开,最后一个离开的人要把门关好。现有一堆杂乱的机房签 到、签离记录,请根据记录找出当天开门和关门的人。 Input测试输入的第一行给出记录的总天数N ( > 0 )。下面列出了N天的记录。 每天的记录在第一行给出记录的条目数M ( > 0 ),下面是M行,每行的格式为 证件号码 签到时间 签离时间 其中时间按“小时:分钟:秒钟”(各占2位)给...
2018-07-20 09:24:04 78
原创 HDU 2710
Max Factor Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 11585 Accepted Submission(s): 3666 Problem Description To i...
2018-07-20 08:41:45 137
原创 HDU 2710
Max FactorTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11584 Accepted Submission(s): 3665 Problem DescriptionTo improve the organi...
2018-07-19 22:56:54 86
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人