蓝桥杯例题part12汇总.docx
- 文档编号:18419207
- 上传时间:2023-08-16
- 格式:DOCX
- 页数:127
- 大小:656.93KB
蓝桥杯例题part12汇总.docx
《蓝桥杯例题part12汇总.docx》由会员分享,可在线阅读,更多相关《蓝桥杯例题part12汇总.docx(127页珍藏版)》请在冰点文库上搜索。
蓝桥杯例题part12汇总
Oh,mygoddess
时间限制:
3000ms|内存限制:
65535KB
难度:
3
描述
ShiningKnightistheembodimentofjusticeandhehasaverysharpswordcanevencleavewall.Manybadguysaredeadonhissword.
Oneday,twoevilsorcerercgangeeandJackchessdecidedtogivehimsomecolortosee.SotheykidnappedShiningKnight'sbelovedgirl--MissIce!
TheybuiltaMxNmazewithmagicandshutherupinit.
ShiningKnightarrivesatthemazeentranceimmediately.Hecanreachanyadjacentemptysquareoffourdirections--up,down,left,andrightin1second.Orcleaveoneadjacentwallin3
seconds,namely,turnitintoemptysquare.It'sthetimetosavehisgoddess!
Notice:
ShiningKnightwon'tleavethemazebeforehefindMissIce.
输入
Theinputconsistsofblocksoflines.Thereisablanklinebetweentwoblocks.
ThefirstlineofeachblockcontainstwopositiveintegersM<=50andN<=50separatedbyonespace.IneachofthenextMlinesthereisastringoflengthNcontentsOand#.
Orepresentsemptysquares.#meansawall.
Atlast,thelocationofMissIce,(x,y).1<=x<=M,1<=y<=N.
(ShiningKnightalwaysstartsatcoordinate(1,1).BothShiningandIce'slocationguaranteenottobeawall.)
输出
TheleastamountoftimeShiningKnighttakestosavehisgoddessinoneline.
样例输入
35
O####
#####
#O#O#
34
样例输出
14
世界末日
时间限制:
1000ms|内存限制:
65535KB
难度:
1
描述
世界末日马上就要来临了,当然,每个人都想买到船票,但是由于船票有限,因此需要回答对一个问题才能买票。
问题是这样的:
给你一个数n(1<=n<=10000),之后给n个正整数(<=10000),问在这n个数中是否存在一些数的和是n的倍数。
输入
多组测试数据(最多100组)。
首先输入一个数n,然后输入n个数。
输出
如果能找到一些数的和是n的倍数,输出"YES",否则输出"NO"。
样例输入
5
53679
样例输出
YES
我和你
时间限制:
1000ms|内存限制:
65535KB
难度:
2
描述
将一句话中的所有的“我”换成“你”,“你”换成“我”。
输入
多组测试数据
每组给出一句中文,每段少于100个汉字
以单独一个0结束
输出
对于每组测试数据,输出替换后的句子。
样例输入
我爱你
我是中国人
1234我
0
样例输出
你爱我
你是中国人
1234你
提示
注意:
每个中文在windows下占两个字节,ubuntu默认使用UTF-8编码,每个中文占三个字节。
本OJ判题环境为ubuntu
TakeiteasyII
时间限制:
1000ms|内存限制:
65535KB
难度:
0
描述
小蜗牛经过一段时间的学习和训练,水平的到了很大的提升。
但是小蜗牛的时间很少,特别是期末的时候,所以他决定每天做5道题目。
对他而言,他认为每个题目花费的时间应该跟题目的难度成正比,并且每一个题目花费的时间都应该是(5+N*10)分钟,其中N为题目的难度。
如果他花费的总时间超过了预定的时间,他就认为是浪费时间了,否则他就认为是节省时间了。
现在他想知道自己这一天是不是浪费时间了。
输入
输入有多组。
每组数据第一行都有五个数,代表每个题目的难度。
(难度不会小于0,大于10)。
第二行也有五个数,代表对应题目花费的时间。
输出
每组输出一个结果
如果小蜗牛觉得自己没有浪费时间直接输出No!
否则输出Yes并输出浪费的时间.
样例输入
02531
1020604030
78726
6857613215
样例输出
Yes25
No!
找规律
时间限制:
1000ms|内存限制:
65535KB
难度:
2
描述
xiaod在小学时最喜欢上数学课了,有一次上课,数学老师布置了一道题目:
给你一组有规律的整数,而且只给出前5项,让你求出后面5项。
比如:
1,2,3,4,5,__,__,__,__,__。
显然这是等差数列,所以答案应该是6,7,8,9,10。
为了简化题目,老师规定规律只有三种:
等差数列、等比数列、斐波那契数列(f[i]=f[i-2]+f[i-1]);且公差、公比均为整数,所有出现的数字不会超出int范围。
怎么样,很简单吧?
聪明的你,来比一比你和xiaod谁算的快吧。
输入
有多组测试数据。
每行5个整数,代表题目给出的前5项。
输出
如果能找到符合条件的规律,则输出5个整数,代表后5项的值。
否则,请输出"None"。
(引号不用输出)
样例输入
12345
235813
样例输出
678910
21345589144
Geometricsum
时间限制:
1000ms|内存限制:
65535KB
难度:
3
描述
Compute(a+a^2+…+a^n)modm.(a+a2+…an)mod
输入
Threeintegersa,n,m.
(1≤a,n,m≤10^18)
ItendswithEOF.
输出
Theonlyintegerdenotestheresult.
样例输入
221000000000
样例输出
6
牛奶
时间限制:
1000ms|内存限制:
65535KB
难度:
2
描述
伊格内修斯每天都喝牛奶,他现在是在超市里,他要选择一瓶牛奶。
牛奶在超市有很多种,所以伊格内修斯想知道哪种牛奶是最便宜的。
下面是一些规则:
1。
伊格内修斯绝不会喝6天以前或更早的牛奶。
这意味着,如果牛奶是2012-12-22生产的,伊格内修斯绝不会在2012年12月27日之后(包含12月27日)喝这瓶。
2。
伊格内修斯每天要喝200毫升牛奶。
3。
如果留在瓶子里的牛奶不到200毫升,伊格内修斯把它扔掉。
4。
所有的在超市的牛奶都是今天刚生产出来的。
请注意,伊格内修斯只想要买一瓶牛奶,因此,如果一个瓶子的容积小于200毫升,你应该忽略它。
给你牛奶的一些信息,你的任务是告诉伊格内修斯牛奶是最便宜的。
输入
有多组测试数据
每组测试数据以一个整数N(1<=N<=100)开始,表示有N种牛奶。
以下N行,每行包含一个字符串S(长度最多100个字符),它表示该牛奶的品牌,然后是两个整数P(yuan)和V(ml),P是这瓶牛奶的价格,V是这瓶牛奶的体积。
输出
对于每个测试样例,你应该输出最便宜的牛奶的品牌。
如果有超过一个最便宜的品牌,你应该输出体积最大的一个。
样例输入
2
Yili10500
Mengniu201000
4
Yili10500
Mengniu201000
Guangming1199
Yanpai4010000
样例输出
Mengniu
Mengniu
发短信
时间限制:
1000ms|内存限制:
65535KB
难度:
3
描述
下图是手机常用的九键英文输入法界面,如果要输入字母'A',我们只
需要按一次数字键2,按键顺序记为2;如果要输入字母'B'的话,我们需要连续按两次数字键2,按键顺序记为22;同理:
字母'C’需要连续按3次数字键2,按键顺序记为222。
通过这种方法,我们用手机10多个键就能输入26个英文字母。
现在你的任务是统计一段英文用手机输入的按键顺序,同样,你也要能把按键顺序翻译成相应的英文内容。
为了使问题简化,我们假设内容只有大写英文字母和空格。
输入
有多组测试数据
每组测试数据占一行,有两种情况:
(1)短信内容(只含有若干个空格和大写字母,不超过1000个字符)
(2)短信按键顺序(只含有若干空格和数字,其中第一个肯定是数字,不超过1000个字符)
输出
对于每组测试数据:
如果是短信内容,输出每个字母的按键顺序,每个字母的按键顺序用空格隔开
如果是按键顺序,输出它代表的内容
样例输入
ILOVEYOU
HELLOWORLD
444055566688833099966688
4433555555666096667775553
样例输出
444055566688833099966688
4433555555666096667775553
ILOVEYOU
HELLOWORLD
orz
时间限制:
1000ms|内存限制:
65535KB
难度:
4
描述
NowyougetanumberN,andaM-integersset,youshouldfindouthowmanyintegerswhicharesmallthanN,thattheycandividedexactlybyanyintegersintheset.Forexample,N=12,andM-integersetis{2,3},sothereisanotherset{2,3,4,6,8,9,10},alltheintegersofthesetcanbedividedexactlyby2or3.Asaresult,youjustoutputthenumber7
输入
Therearealotofcases.Foreachcase,thefirstlinecontainstwointegersNandM.ThefollowlinecontainstheMintegers,andallofthemaredifferentfromeachother.0 输出 Foreachcase,outputthenumber 样例输入 122 23 样例输出 7 骰子 时间限制: 1000ms|内存限制: 65535KB 难度: 2 描述 小明有m个骰子,每一个骰子都是标准六面骰子,问题很简单,请求出他掷出固定点数的方法数 输入 有多组测试数据 每行一个整数m,k,m表示骰子的数量,k表示要掷的点数(1<=m<=100,0<=k<1000) 输出 每行输出掷出固定点数的方法数,算出的结果对100007取余 样例输入 21 23 样例输出 0 2 PrimesonInterval 时间限制: 3000ms|内存限制: 65535KB 难度: 3 描述 You'vedecidedtocarryoutasurveyinthetheoryofprimenumbers.Letusremindyouthataprimenumberisapositiveintegerthathasexactlytwodistinctpositiveintegerdivisors. Considerpositiveintegersa,a + 1,...,b(a ≤ b).Youwanttofindtheminimumintegerl(1 ≤ l ≤ b - a + 1)suchthatforanyintegerx(a ≤ x ≤ b - l + 1)amonglintegersx,x + 1,...,x + l - 1thereareatleastkprimenumbers. Findandprinttherequiredminimuml.Ifnovaluelmeetsthedescribedlimitations,print-1. 输入 Asinglelinecontainsthreespace-separatedintegersa, b, k(1 ≤ a, b, k ≤ 106;a ≤ b). 输出 Inasinglelineprintasingleinteger—therequiredminimuml.Ifthere'snosolution,print-1. 样例输入 242 6131 143 样例输出 3 4 -1 奋斗小蜗牛在请客 时间限制: 1000ms|内存限制: 65535KB 难度: 2 描述 一路艰辛一路收获,成功爬过金字塔的小蜗牛别提多高兴了。 这不为了向曾经帮助他的哥们们表达谢意,蜗牛宴请这些亲朋好友。 席间,蜗牛发现老鹰一直愁眉不展。 就关切的问下老鹰。 老鹰说: “近来,有一道题我一直没解决,很是郁闷”。 蜗牛说: “说说看,看能不能帮你解决掉,老朋友”。 老鹰说: “给一个数,用二进制表达,如果这个数转化为二进制后小数位超过20位,那么只要前二十位,其余的不要”,小蜗牛现在很忙,没时间帮助老鹰。 亲爱的兄弟姐妹们,不知道你能否帮忙解决问题。 来试下,加油! ! ! 输入 多组测试数据, 每组输入一个数N(不超double) 输出 输出对应的二进制(如果小数部分前20全部为0,则将小数部分视为0,不输出小数部分,不输出多余部分比如: (不输出1.00100000000000000000而输出1.001) 样例输入 1 1.5 0.000001 0.000000999 样例输出 1 1.1 0.00000000000000000001 0.00000000000000000001 数字1的数量 时间限制: 1000ms|内存限制: 65535KB 难度: 1 描述 给定一个十进制正整数N,写下从1开始,到N的所有正数,计算出其中出现所有1的个数。 例如: n=12,包含了5个1。 1,10,12共包含3个1,11包含2个1,总共5个1。 输入 输入N(0<=N<=10^9) 多组测试数据 输出 输出包含1的个数 样例输入 12 样例输出 5 Books 时间限制: 1000ms|内存限制: 65535KB 难度: 1 描述 WhenValerahasgotsomefreetime,hegoestothelibrarytoreadsomebooks.Todayhe'sgottfreeminutestoread.That'swhyValeratooknbooksinthelibraryandforeachbookheestimatedthetimeheisgoingtoneedtoreadit.Let'snumberthebooksbyintegersfrom1ton.Valeraneedsaiminutestoreadthei-thbook. Valeradecidedtochooseanarbitrarybookwithnumberiandreadthebooksonebyone,startingfromthisbook.Inotherwords,hewillfirstreadbooknumberi,thenbooknumberi + 1,thenbooknumberi + 2andsoon.Hecontinuestheprocessuntilheeitherrunsoutofthefreetimeorfinishesreadingthen-thbook.Valerareadseachbookuptotheend,thatis,hedoesn'tstartreadingthebookifhedoesn'thaveenoughfreetimetofinishreadingit. PrintthemaximumnumberofbooksValeracanread 输入 Thefirstlinecontainstwointegersnandt(1 ≤ n ≤ 10^5;1 ≤ t ≤ 10^9)—thenumberofbooksandthenumberoffreeminutesValera'sgot.Thesecondlinecontainsasequenceofnintegersa1, a2, ..., an(1 ≤ ai ≤ 10^4),wherenumberaishowsthenumberofminutesthattheboyneedstoreadthei-thbook 输出 Printasingleinteger—themaximumnumberofbooksValeracanread 样例输入 45 3121 33 223 样例输出 3 1 DrawSomething 时间限制: 1000ms|内存限制: 65535KB 难度: 0 描述 Wangpengisgoodatdrawing.Nowhewantstosaynumberslike“521”tohisgirlfriendthroughthegamedrawsomething. Wangpengcan’twritethedigitdirectly.Sohecomesupawaythatdrawingseveralsquaresandthetotalareaofsquaresisthenumberhewantstosay. InputallthesquareWangpengdraws,what’sthenumberinthepicture? 输入 Therearemultipletestcases. Foreachcase,thefirstlinecontainsoneintegerN(1≤N≤100)indicatingthenumberofsquares. SecondlinecontainsNintegersai(1≤ai≤100)representthesidelengthofeachsquare.Nosquareswilloverlap. InputendswithN=0 输出 Foreachcase,outputthetotalareainoneline 样例输入 4 1234 3 333 0 样例输出 30 27 Cuttherope 时间限制: 1000ms|内存限制: 65535KB 难度: 4 描述 WehavearopewhoselengthisL.Wewillcuttheropeintotwoormoreparts,thelengthofeachpartmustbeaninteger,andnotwopartshavethesamelength. Yourtaskistocalculatethereexistshowmanyresultsafterthecutting.Wesaytworesultsaredifferentifandonlyifthereisatleastonepart,whichwecanfindinoneresultbutcannotfindintheotherresult 输入 ThereisanintegerT(1<=T<=50000)inthefirstline,whichindicatesthereareTtestcasesintotal. Foreachtestcase,thereisonlyoneintegerL(1<=L<=50000)whichhasthesamemeaningasabove. 输出 Foreachtestcase,youshouldoutputthecorrectansweroftheabovetaskinoneline. Becausetheanswermaybeverylarge,youshouldjustoutputtheremainderofitdividedby1000000instead 样例输入 3 2 3 6 样例输出 0 1 3 分蛋糕 时间限制: 1000ms|内存限制: 65535KB 难度
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 蓝桥杯 例题 part12 汇总