- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
2014清华大学计算机编程邀请赛试题
Problem S1: Lucky Digit时间限制:1.0s 内存限制:256.0MB 问题描述 Digit K is Kristoff’s lucky digit! Consequently, for every integer N, he wants to know what is the number d (2 ≤ d ≤ 10) such that the base d representation of N ends with the largest number of the digit K’s. Given N and K, please write a program to help Kristoff find the desired base d. For example, suppose Kristoff’s lucky digit is 0, and he is given an integer 8, then d would be 2. Since the base-2 (i.e., binary) representation of 8 is (1000)2 with 3 trailing zeroes, while the number 8 in any other base would have no or fewer trailing zeroes. Your program should print 3 in this case.输入格式 The first and only line contains two integers, N (0 ≤ N ≤ 1011) and K(0 ≤ K ≤ 9).输出格式 Print one line containing one integer, the maximum number of trailing lucky numbers.样例输入49 1样例输出2样例输入7 5样例输出0Problem S2: Summation时间限制:1.0s 内存限制:256.0MB 问题描述 Given three integers A, K, P, you are asked to calculate the value of the following summation.输入格式 The first and only line of the input contains 3 integers, A (0 ≤ A ≤ 108), K(1 ≤ K ≤ 1016) and P (1 ≤ P ≤ 108), separated by a space. In 20% of the test cases, K is no larger than 10000. In 50% of the test cases, P is a prime number and no larger than输出格式 The only line in the output contains a single integer, the value of the summation.样例输入3 4 101样例输出19Problem S3: Magic Rocks时间限制:1.0s 内存限制:256.0MB 问题描述 When Olaf was walking in the forest, he stumbled upon a sequence of N colored rocks. He noticed that if he touched K or more consecutive rocks of the same color, they would twinkle and then vanish. Olaf would like all the rocks to vanish. Consequently, he brought along an inexhaustible supply of rocks, so that he can insert any number of rocks of any colors anywhere in the sequence. Please help Olaf find the smallest number of rocks he must insert into the sequence before he could make all the rocks vanish, including those inserted by himself.输入格式 The first line contains two integers N
您可能关注的文档
最近下载
- 2025年新大象版三年级上册科学全册精编知识点(新编辑).pdf
- 学科建设的要素及原则.pdf VIP
- LEHY-Pro电梯维保初级讲师培训20210628.pptx VIP
- 硼中子俘获治疗技术及应用.pptx VIP
- 电商法律风险防范与规避培训.pptx VIP
- 中国中医药“十三五”规划教材 内经原文背诵.pdf VIP
- 《城镇污水处理厂尾水湿地运行与维护技术规程》(DB32/T 4788-2024).pdf VIP
- 迈瑞病人数据共享协议开发指南.pdf VIP
- 专题 10习作训练 部编版三年级语文下册期中专项复习含答案.docx VIP
- T/CABCI 002-2018_全谷物焙烤食品.pdf VIP
原创力文档


文档评论(0)