Love丶FFC's Blog
2004 年 7 月,谷歌在硅谷的 101 号公路边竖立了一块巨大的广告牌(如下图)用于招聘。内容超级简单,就是一个以 .com 结尾的网址,而前面的网址是一个 10 位素数,这个素数是自然常数 e 中最早出现的 10 位连续数字。能找出这个素数的人,就可以通过访问谷歌的这个网站进入招聘流程的下一步。
自然常数 e 是一个著名的超越数,前面若干位写出来是这样的:e = 2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921... 其中粗体标出的 10 位数就是答案。
本题要求你编程解决一个更通用的问题:从任一给定的长度为 L 的数字中,找出最早出现的 K 位连续数字所组成的素数。
输入在第一行给出 2 个正整数,分别是 L(不超过 1000 的正整数,为数字长度)和 K(小于 10 的正整数)。接下来一行给出一个长度为 L 的正整数 N。
在一行中输出 N 中最早出现的 K 位连续数字所组成的素数。如果这样的素数不存在,则输出 404
。注意,原始数字中的前导零也计算在位数之内。例如在 200236 中找 4 位素数,0023 算是解;但第一位 2 不能被当成 0002 输出,因为在原始数字中不存在这个 2 的前导零。
20 5
23654987725541023819
49877
10 3
2468024680
404
例如L=11,K=3,A=23654826235,可以采用如下算法
1.对A的每一位进行遍历
2.生成A[:3],A[:3]=236,对236进行素数判断,如果是则输出,不是则重复第1步
依次生成A[:3]=236,A[1:4]=365,A[2:5]=654····
import math Length, PrimeLength = map(int, input().split()) # 输入数字长度、要寻找的素数串的长度 Number = int(input()) # 输入该数字 Judge = False # 标记Number中是否存在素数,默认为否 for i in range(Length - PrimeLength + 1): PrimeString = str(Number)[i:i + PrimeLength] # 生成假定的素数串 PrimeNumber = int(PrimeString) # 转为数字 PrimeJudge = True # 标记PrimeNumber是否为素数,默认为是 for j in range(2, int(math.sqrt(PrimeNumber)) + 1): # 素数判断 if PrimeNumber % j == 0: PrimeJudge = False break if PrimeJudge: print(PrimeString) Judge = True break if not Judge: print("404")
fruinly
buy cialis online with a prescription In certain embodiments parenteral routes are desirable since they avoid contact with the digestive enzymes that are found in the alimentary canal
engarma
I have unexplained infertility and all my tests come back normal royal honey viagra Pfammatter JP, Clericetti Affolter C, Truttmann AC, Busch K, Laux End R, Bianchetti MG
jordans for cheap
I just wanted to thank you for the fast service. in addition to they look great. I received them a day earlier than expected. most notably I will definitely continue to buy from this site. manner in which I will recommend this site to my friends. Thanks!
jordans for cheap https://www.realcheapretrojordanshoes.com/
cheap jordans
I just wanted to thank you for the fast service. or sometimes they look great. I received them a day earlier than expected. for example the I will definitely continue to buy from this site. situation I will recommend this site to my friends. Thanks!
cheap jordans https://www.cheaprealjordan.com/
cheap louis vuitton outlet
I just wanted to thank you for the fast service. or they look great. I received them a day earlier than expected. particularly I will definitely continue to buy from this site. in any event I will recommend this site to my friends. Thanks!
cheap louis vuitton outlet https://www.bestlouisvuittonoutlet.com/
cheap louis vuitton outlet
I just wanted to thank you for the fast service. or simply they look great. I received them a day earlier than expected. as good as the I will definitely continue to buy from this site. either way I will recommend this site to my friends. Thanks!
cheap louis vuitton outlet https://www.cheaplouisvuittonoutlets.com/
cheap jordan shoes
Read reviews and was a little hesitant since I had already inputted my order. actually but thank god, I had no issues. for example received item in a timely matter, they are in new condition. in any event so happy I made the purchase. Will be definitely be purchasing again.
cheap jordan shoes https://www.cheapretrojordan.com/
louis vuitton outlet sale online
Read reviews and was a little hesitant since I had already inputted my order. or perhaps a but thank god, I had no issues. the same as the received item in a timely matter, they are in new condition. anyway so happy I made the purchase. Will be definitely be purchasing again.
louis vuitton outlet sale online https://www.louisvuittonsoutlet.com/
cheap louis vuitton outlet
Read reviews and was a little hesitant since I had already inputted my order. or a but thank god, I had no issues. cherish the received item in a timely matter, they are in new condition. in any event so happy I made the purchase. Will be definitely be purchasing again.
cheap louis vuitton outlet https://www.louisvuittonsoutletonline.com/
cheap jordans online
Read reviews and was a little hesitant since I had already inputted my order. nor but thank god, I had no issues. which include the received item in a timely matter, they are in new condition. you ultimately choose so happy I made the purchase. Will be definitely be purchasing again.
cheap jordans online https://www.realjordansretro.com/
Preliaf
They would like to make temporary funding bills, such as the one the Senate passed last week to keep the government funded, and regular increases to the debt ceiling perfunctory matters that are routinely approved without bringing Washington to the brink of disaster each time black viagra 200mg 145 of 170 85
Preliaf
cialis vs. viagra recreational use Patients whose nausea and vomiting are not adequately controlled despite receiving low or moderately emetogenic chemotherapy may, nevertheless, require more effective and costly agents
https://clients1.google.bt/url?q=https://www.topfakeyeezys.com/
|White and black are always popular colors that you will want to wear. Models are sporting colorless looks at every fashion show. You can certainly fit these colors into many of your outfits. Black and white separates offer endless possibilities.
VTDQboz
We recommend starting with a light dose and increasing to a standard dose over 2 to 4 weeks cialis generic buy
golden goose purestar
Howdy! I simply want to give a huge thumbs up for the nice info you’ve right here on this post. I shall be coming back to your weblog for extra soon.
off white
https://smartlearningapproach.com/শ্বসন-ও-শ্বাসক্রিয়া-জ্ঞা/
fear of god clothing
http://test.homeplay.se/nysida3/index.php/component/k2/item/84-honda-goldwing-2014?start=71090
bape t shirt
http://eximaco.com/index.php/component/k2/item/33<?limit=10&start=26530
curry 6
https://fly.techionblog.com/6478711/
golden goose
https://gufosaggio.net/info/52928/come-cambiare-i-bitcoin-in-euro
off white jordan 1
https://www.comuniecitta.it/montagne-piu-alte-d-italia
golden goose skystar
A formidable share, I just given this onto a colleague who was doing a little bit analysis on this. And he in truth purchased me breakfast as a result of I found it for him.. smile. So let me reword that: Thnx for the treat! However yeah Thnkx for spending the time to debate this, I really feel strongly about it and love reading extra on this topic. If attainable, as you grow to be expertise, would you thoughts updating your weblog with extra details? It is extremely useful for me. Big thumb up for this weblog post!
curry 8
http://www.uneac.org.cu/secciones/en-la-uneac-evento-teorico-piensas-ya-en-el-humor/
nike sb
http://upakcanna.com/product/jupiter-liquidx-glass-500?page_l=8
Knzwbb
buy tricor 160mg for sale tricor 200mg sale tricor 200mg pills
kyrie irving
http://athlitikoithesmoi.gr/index.php/component/k2/item/17-quisque-lacinia-mauris?start=1220
jordan outlet
https://www.yabiladi.ma/articles/details/141217/丕賱賵賰丕賱丞-丕賱丨囟乇賷丞-賱胤賳噩丞-鬲賵丕賰亘-丕賱賲賯丕賲.html
golden goose francy
There is noticeably a bundle to know about this. I assume you made certain good points in features also.
golden goose sneakers
The subsequent time I read a weblog, I hope that it doesnt disappoint me as much as this one. I imply, I do know it was my option to read, however I actually thought youd have one thing fascinating to say. All I hear is a bunch of whining about something that you might fix for those who werent too busy searching for attention.
off-white
An impressive share, I simply given this onto a colleague who was doing a little bit evaluation on this. And he actually bought me breakfast as a result of I found it for him.. smile. So let me reword that: Thnx for the deal with! But yeah Thnkx for spending the time to debate this, I feel strongly about it and love reading extra on this topic. If doable, as you turn into experience, would you thoughts updating your blog with more particulars? It is extremely useful for me. Massive thumb up for this blog put up!
russell westbrook shoes
Aw, this was a very nice post. In thought I would like to put in writing like this moreover ?taking time and precise effort to make a very good article?however what can I say?I procrastinate alot and under no circumstances appear to get one thing done.
bape hoodie
After study a number of of the weblog posts on your web site now, and I actually like your approach of blogging. I bookmarked it to my bookmark website list and might be checking again soon. Pls try my website as well and let me know what you think.
Zvcizj
cost cialis 10mg cialis 40mg oral viagra order online
off white t shirt
I抎 must examine with you here. Which isn’t one thing I usually do! I enjoy reading a submit that may make individuals think. Also, thanks for allowing me to remark!
kobe shoes
Youre so cool! I dont suppose Ive learn something like this before. So good to find someone with some unique thoughts on this subject. realy thanks for starting this up. this website is something that’s needed on the net, someone with slightly originality. helpful job for bringing something new to the internet!
Fomyiy
ketotifen 1mg pill buy tofranil sale buy tofranil 75mg online
goyard handbag
very nice submit, i definitely love this web site, keep on it
Gohxoy
minoxytop price top ed pills online ed meds
Isxvrd
buy generic acarbose precose online buy griseofulvin medication
Lfgwqg
aspirin for sale where can i buy lquin buy imiquad online cheap