hello kity
期待您的批阅,由于写解题报告时 不一定考虑的很周到,所以如果您有什么不懂的地方,请您留言,然而一天之内我肯定会看见您信息,再对代码注释详细,让您更好的阅读
分类
最新评论
最新留言
链接
RSS
计数器
222883
功能
PKU_2081 Recaman's Sequence
spoiler
posted @ 2011年3月31日 20:00
in 未分类
, 1708 阅读
题目分析:也属于动态规划的 一个题目,当求得的a[m]为正值并且在前面的序列中未曾出现过 a[m]=a[m-1]-m。反之a[m]=a[m-1]+m;由于处理的数据非常多 非常容易超时,所以必须一次性计算出0<=i<500000内所有a[i]的值,然后输入i的时候直接输出就可以了。
提示:因为数据非常多所以要用个数组记录a[i]是否出现过,切忌用来记录的数组一定要开的大一点 不然你会发现一直编译过不了,出现很奇怪的错误。
源程序:
#include<iostream> using namespace std; bool sim[3500000]={false}; int a[500001]={0}; int main(){ int i,s,n; for(i=1;i<500000;i++){ s=a[i-1]-i; if(s>0&&!sim[s]) a[i]=s; else a[i]=a[i-1]+i; sim[a[i]]=true; } while(cin>>n&&n!=-1) cout<<a[n]<<endl; return 0; }
总结:只要细心点,注意数组开的合适点,还有先把所有的0<=i<500000的都计算好,然后直接读取输出就可以AC了^_^.
2024年1月14日 00:04
Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, grea
2024年1月21日 19:47
Good Hello! My Name is Hunan I am a professional SEO expert having 4 years . I am specialized in backlinks, creation, off page SEO, website ranking, website taffic, you will come to the right place, Feel free to contact me I see some amazingly important and kept up to length of your strength searching for in your on the site
2024年1月21日 20:26
This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the good work. I have been meaning to write something like this on my website and you have given me an idea.
2024年1月21日 20:39
Good Thank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free.
2024年1月21日 21:09
I really wanted to make a quick remark to say thanks to you for the splendid steps you are placing on this site. My extended internet investigation has at the end of the day been paid with useful insight to share with my classmates and friends Just saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay informed of any updates.
2024年1月21日 21:21
I’m excited to uncover this page. I need to to thank you for ones time for this particularly fantastic read!! I definitely really liked every part of it and i also have you saved to fav to look at new information in your site. I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website. Thumbs up guys your doing a really good job.
2024年1月21日 21:27
I really wanted to make a quick remark to say thanks to you for the splendid steps you are placing on this site. My extended internet investigation has at the end of the day been paid with useful insight to share with my classmates and friends Just saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay informed of any updates.
2024年1月21日 21:37
A to a great degree brilliant blog passage. We are really grateful for your blog passage. fight, law usage You will find an extensive measure of techniques in the wake of heading off to your post. I was absolutely examining for. An obligation of appreciation is all together for such post and please keep it up. Mind blowing work.
2024年1月21日 21:52
I no uncertainty esteeming each and every bit of it. It is an amazing site and superior to anything normal give. I need to grateful. Marvelous work! Every one of you complete an unfathomable blog, and have some extraordinary substance. Keep doing stunning. As a Newbie, I am always exploring online for articles that can be of assistance to me. Thank you
2024年1月21日 22:27
"I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work… These fortunate web sites are properly ranked by Bing, and by backlinking your site may also position well.
"
2024年1月21日 22:34
Please let me know if you’re looking for a article writer for your site. You have some really great posts and I feel I would be a good asset. If you ever want to take some of the load off, I’d absolutely love to write some material for your blog in exchange for a link back to mine. Please send me an email if interested. Thank you!
2024年1月21日 22:43
Good Thank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free.
2024年1月21日 22:51
I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.
2024年1月21日 22:51
I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.
2024年1月21日 22:57
I really enjoyed reading this post, big fan. Keep up the good work andplease tell me when can you publish more articles or where can I read more on the subject? I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have.
2024年1月21日 23:06
Good Thank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free.
2024年1月21日 23:16
I no uncertainty esteeming each and every bit of it. It is an amazing site and superior to anything normal give. I need to grateful. Marvelous work! Every one of you complete an unfathomable blog, and have some extraordinary substance. Keep doing stunning. As a Newbie, I am always exploring online for articles that can be of assistance to me. Thank you
2024年1月21日 23:23
Very nice blog and articles. I am realy very happy to visit your blog. Now I am found which I actually want. I check your blog everyday and try to learn something from your blog. Thank you and waiting for your new post.Very nice blog and articles. I am realy very happy to visit your blog. Now I am found which I actually want. I check your blog everyday and try to learn something from your blog. Thank you and waiting for your new post.
2024年1月21日 23:27
I no uncertainty esteeming each and every bit of it. It is an amazing site and superior to anything normal give. I need to grateful. Marvelous work! Every one of you complete an unfathomable blog, and have some extraordinary substance. Keep doing stunning. As a Newbie, I am always exploring online for articles that can be of assistance to me. Thank you
2024年1月21日 23:38
"Excellent post. I was always checking this blog, and I’m impressed! Extremely useful info specially the last part, I care for such information a lot. I was exploring this particular info for a long time. Thanks to this blog my exploration has ended.The problem we struggled with was how to provide more assistance
to those in need without the resources to create more bed space."
2024年1月21日 23:46
I no uncertainty esteeming each and every bit of it. It is an amazing site and superior to anything normal give. I need to grateful. Marvelous work! Every one of you complete an unfathomable blog, and have some extraordinary substance. Keep doing stunning. As a Newbie, I am always exploring online for articles that can be of assistance to me. Thank you
2024年1月21日 23:56
"I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work… These fortunate web sites are properly ranked by Bing, and by backlinking your site may also position well.
"
2024年1月22日 00:03
Please let me know if you’re looking for a article writer for your site. You have some really great posts and I feel I would be a good asset. If you ever want to take some of the load off, I’d absolutely love to write some material for your blog in exchange for a link back to mine. Please send me an email if interested. Thank you!
2024年1月22日 00:08
"I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work… These fortunate web sites are properly ranked by Bing, and by backlinking your site may also position well.
"
2024年1月22日 00:10
Succeed! It could be one of the most useful blogs we have ever come across on the subject. Excellent info! I’m also an expert in this topic so I can understand your effort very well. Thanks for the huge help Good website! I truly love how it is easy on my eyes it is. I am wondering how I might be notified whenever a new post has been made. I have subscribed to your RSS which may do the trick? Have a great day!
2024年1月22日 00:28
Youre so cool! I dont suppose Ive learn something like this before. So good to find somebody with some unique ideas on this subject. realy thank you for beginning this up. this website is something that is needed on the net, somebody with somewhat originality. helpful job for bringing something new to the internet!
2024年1月22日 00:36
Excellent post. I was always checking this blog, and I’m impressed! Extremely useful info specially the last part, I care for such information a lot. I was exploring this particular info for a long time. Thanks to this blog my exploration has endedFabulous post, you have denoted out some fantastic points, I likewise think this s a very wonderful website. I will visit again for more quality contents and also, recommend this site to all. Thanks.
2024年1月22日 00:36
"I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work… These fortunate web sites are properly ranked by Bing, and by backlinking your site may also position well.
"
2024年1月22日 00:49
I truly welcome this superb post that you have accommodated us. I guarantee this would be valuable for the vast majority of the general population. I am reading your writing well. I know a site that might be helpful for your writing. please read my article and tell us your impressions. After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article . This is an excellent post I seen thanks to share it. It is really what I wanted to see hope in future you will continue for sharing such a excellent post . Really i appreciate the effort you made to share the knowledge. The topic here i found was really effective to the topic which i was researching for a long time
2024年1月22日 00:58
Excellent post. I was always checking this blog, and I’m impressed! Extremely useful info specially the last part, I care for such information a lot. I was exploring this particular info for a long time. Thanks to this blog my exploration has endedFabulous post, you have denoted out some fantastic points, I likewise think this s a very wonderful website. I will visit again for more quality contents and also, recommend this site to all. Thanks.
2024年1月22日 01:04
"This is really wonderful, one-of-a-kind as well as really helpful post, i like it. many thanksHello, I wish for to subscribe for this webpage to take latest updates, so where can i do it please assist Greetings, by utilizing Google I discovered your site even as chasing down a similar subject, your site came up, it looks truly intriguing. I bookmarked it.
"
2024年1月22日 01:14
I truly welcome this superb post that you have accommodated us. I guarantee this would be valuable for the vast majority of the general population. I am reading your writing well. I know a site that might be helpful for your writing. please read my article and tell us your impressions. After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article . This is an excellent post I seen thanks to share it. It is really what I wanted to see hope in future you will continue for sharing such a excellent post . Really i appreciate the effort you made to share the knowledge. The topic here i found was really effective to the topic which i was researching for a long time
2024年1月22日 01:21
Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more. i am for the first time here. I found this board and I in finding It truly helpful & it helped me out a lot. I hope to present something back and help others such as you helped me. I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought you have something interesting to say. All I hear is a bunch of whining about something that you could fix if you werent too busy looking for attention
2024年1月22日 01:38
Excellent post. I was always checking this blog, and I’m impressed! Extremely useful info specially the last part, I care for such information a lot. I was exploring this particular info for a long time. Thanks to this blog my exploration has ended.Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info
2024年1月22日 02:12
I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.
2024年1月22日 02:35
I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.
2024年1月22日 02:45
I am really extremely glad to visit your blog. Keep doing awesome! If you want to know how to get paid apps for free, for paid free apps you can download apps from appyeet platform, in these platforms you can download both cracked and moded apps for more info you can visit our blog about appyeet apk.