24 544984352
一开始,尽力想了,但是发现不会递推
然后看了题解,才秒懂。。。只能说太抽象了,
但又感觉很实际,就是一定得找到最后的要求是什么,需要什么。
第 i 天有多少种方案。
令dp[i] 为第i天有多少种不同方案。
跟第i – 1 天有关,如果第i 天是 1 ,如果第i-1天是0,或者2肯定可以满足条件
如果第i-1天是1,由不能连续三天是同一个数字,所以i – 2天一定得是0或者2.
得到状态转移方程:
dp[i – 1] 为 第i-1天有多少种不同方案,那第i天选择1 或者 2 或者 3 就有不同情况了
然后构成状态转移方程式,参考分类计数原理和分步计数原理。
dp[i] = dp[i-1] * 2 + dp[i-2] * 2;
//————————-代码—————————-
#define int LL
const int N = 1e6+10;
int n,m;
int p[N];
int inf = 1e9+7;
void solve()
{
cin>>n;
// V<V<int>>mp(n+1,V<int>(m+1));
cout<<p[n]<<endl;
}
void pre() {
p[1] = 3;
p[2] = 9;
fo(i,3,100000) {
p[i] = 2 * (p[i-1] + p[i-2] + inf) % inf;
}
}
signed main(){
clapping();TLE;
pre();
int t;cin>>t;while(t — )
solve();
// {solve(); }
return 0;
}
/*样例区
*/
//————————————————————
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(111)
справки москва
Hi there! I could have sworn I’ve been to this blog before but after reading through some of the post I realized it’s new to me. Nonetheless, I’m definitely glad I found it and I’ll be bookmarking and checking back often!
When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get three emails with the same comment. Is there any way you can remove me from that service? Appreciate it!
At this time I am going away to do my breakfast, when having my breakfast coming yet again to read additional news.
Hi there, just wanted to say, I liked this article. It was inspiring. Keep on posting!
Oh my goodness! Awesome article dude! Thank you, However I am going through problems with your RSS. I don’t know why I am unable to subscribe to it. Is there anybody else getting identical RSS problems? Anybody who knows the solution will you kindly respond? Thanx!!
Very good site you have here but I was curious about if you knew of any user discussion forums that cover the same topics talked about in this article? I’d really love to be a part of online community where I can get comments from other knowledgeable individuals that share the same interest. If you have any recommendations, please let me know. Thank you!
Hello there, just became aware of your blog through Google, and found that it is really informative. I’m gonna watch out for brussels. I will appreciate if you continue this in future. A lot of people will be benefited from your writing. Cheers!
Fantastic site. A lot of useful information here. I’m sending it to a few pals ans also sharing in delicious. And naturally, thank you for your effort!
Wow, marvelous blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your web site is great, let alone the content!
Sweet blog! I found it while browsing on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Thanks
I know this if off topic but I’m looking into starting my own blog and was wondering what all is required to get set up? I’m assuming having a blog like yours would cost a pretty penny? I’m not very internet savvy so I’m not 100% positive. Any recommendations or advice would be greatly appreciated. Thank you
This is a good tip especially to those new to the blogosphere. Short but very accurate information Thank you for sharing this one. A must read article!
Hi Dear, are you actually visiting this site regularly, if so then you will absolutely take pleasant experience.
Hello, I check your new stuff daily. Your writing style is awesome, keep up the good work!
Hi there to every one, as I am in fact keen of reading this webpage’s post to be updated regularly. It contains pleasant information.
Keep on working, great job!
Excellent post. I was checking continuously this blog and I am impressed! Very useful information particularly the last part :) I care for such info a lot. I was seeking this particular info for a long time. Thank you and good luck.
I don’t know if it’s just me or if everyone else experiencing problems with your website. It seems like some of the text within your posts are running off the screen. Can someone else please comment and let me know if this is happening to them too? This could be a problem with my web browser because I’ve had this happen before. Thanks
My spouse and I stumbled over here coming from a different website and thought I might check things out. I like what I see so now i am following you. Look forward to going over your web page for a second time.
Hi Dear, are you actually visiting this web site daily, if so then you will absolutely get nice experience.
I am regular reader, how are you everybody? This piece of writing posted at this web site is really pleasant.
Very rapidly this website will be famous among all blogging people, due to it’s pleasant posts
For most up-to-date news you have to visit web and on world-wide-web I found this site as a best web site for latest updates.
you are in point of fact a good webmaster. The web site loading speed is incredible. It kind of feels that you are doing any unique trick. Moreover, The contents are masterpiece. you have performed a fantastic activity in this topic!
Aw, this was a really nice post. Spending some time and actual effort to produce a really good article but what can I say I put things off a lot and never seem to get anything done.
I’d like to find out more? I’d care to find out more details.
Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a bit, but other than that, this is magnificent blog. An excellent read. I’ll definitely be back.
I’m not sure why but this website is loading extremely slow for me. Is anyone else having this issue or is it a problem on my end? I’ll check back later and see if the problem still exists.
Hello! I’ve been following your website for a while now and finally got the bravery to go ahead and give you a shout out from Humble Tx! Just wanted to mention keep up the great job!
This blog was… how do I say it? Relevant!! Finally I have found something that helped me. Thanks!
Thank you for the auspicious writeup. It if truth be told used to be a amusement account it. Glance complex to far introduced agreeable from you! By the way, how can we communicate?
My spouse and I absolutely love your blog and find many of your post’s to be exactly what I’m looking for. Does one offer guest writers to write content to suit your needs? I wouldn’t mind producing a post or elaborating on many of the subjects you write related to here. Again, awesome weblog!
Hey there would you mind stating which blog platform you’re working with? I’m planning to start my own blog in the near future but I’m having a difficult time selecting between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I’m looking for something completely unique. P.S Apologies for getting off-topic but I had to ask!
What i do not realize is actually how you’re now not really a lot more smartly-favored than you may be right now. You are so intelligent. You know therefore significantly with regards to this topic, produced me individually consider it from numerous numerous angles. Its like men and women don’t seem to be fascinated until it’s something to accomplish with Woman gaga! Your personal stuffs great. All the time care for it up!
Howdy! Do you know if they make any plugins to protect against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any recommendations?
For newest news you have to visit web and on web I found this web site as a best site for most up-to-date updates.
Aw, this was an incredibly nice post. Spending some time and actual effort to produce a top notch article but what can I say I procrastinate a lot and never seem to get anything done.
Первоклассный мужской эротический массаж в Москве релакс спа
Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You definitely know what youre talking about, why waste your intelligence on just posting videos to your site when you could be giving us something enlightening to read?
Hello there, You have done a great job. I will definitely digg it and personally recommend to my friends. I am sure they will be benefited from this web site.
Pretty! This was a really wonderful post. Thank you for providing this information.
Keep this going please, great job!
I think this is one of the so much significant information for me. And i’m glad reading your article. However wanna observation on few general things, The site taste is great, the articles is actually nice : D. Good task, cheers
What’s up to all, it’s actually a nice for me to go to see this website, it contains helpful Information.
Hi there, I check your new stuff regularly. Your writing style is awesome, keep up the good work!
If you are going for best contents like me, only visit this web site everyday as it gives quality contents, thanks
This piece of writing provides clear idea designed for the new people of blogging, that in fact how to do blogging.
It’s really a cool and helpful piece of information. I’m satisfied that you shared this helpful info with us. Please stay us informed like this. Thank you for sharing.
Thank you for sharing your info. I truly appreciate your efforts and I am waiting for your next post thank you once again.
What’s up to all, how is all, I think every one is getting more from this website, and your views are pleasant designed for new viewers.
For newest news you have to visit world-wide-web and on web I found this website as a most excellent website for newest updates.
fantastic issues altogether, you just won a logo new reader. What might you suggest in regards to your post that you made a few days ago? Any sure?
If you desire to improve your experience only keep visiting this web site and be updated with the newest news posted here.
I’m really enjoying the design and layout of your site. It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Excellent work!
First off I want to say superb blog! I had a quick question that I’d like to ask if you don’t mind. I was curious to know how you center yourself and clear your mind before writing. I have had trouble clearing my mind in getting my thoughts out. I do enjoy writing but it just seems like the first 10 to 15 minutes are usually wasted just trying to figure out how to begin. Any suggestions or tips? Thanks!
Hey there! I just wanted to ask if you ever have any trouble with hackers? My last blog (wordpress) was hacked and I ended up losing months of hard work due to no backup. Do you have any solutions to prevent hackers?
Fine way of describing, and good article to take information concerning my presentation topic, which i am going to convey in academy.
It’s awesome to go to see this web site and reading the views of all mates about this post, while I am also keen of getting experience.
Hey there! This post couldn’t be written any better! Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thank you for sharing!
Your way of explaining everything in this article is in fact nice, all can easily know it, Thanks a lot.
Hello there, You have performed a fantastic job. I will definitely digg it and personally recommend to my friends. I am sure they will be benefited from this web site.
Wonderful beat ! I wish to apprentice even as you amend your site, how can i subscribe for a blog web site? The account aided me a applicable deal. I were tiny bit familiar of this your broadcast provided brilliant transparent concept
Every weekend i used to go to see this site, as i want enjoyment, as this this web site conations really good funny data too.
It is perfect time to make some plans for the future and it is time to be happy. I have read this post and if I could I wish to suggest you few interesting things or suggestions. Perhaps you could write next articles referring to this article. I wish to read more things about it!
Asking questions are truly nice thing if you are not understanding anything entirely, but this piece of writing gives nice understanding even.
Hi, yeah this article is truly good and I have learned lot of things from it regarding blogging. thanks.
This text is invaluable. Where can I find out more?
I used to be recommended this blog through my cousin. I am not sure whether this post is written by means of him as no one else recognise such distinct approximately my difficulty. You are wonderful! Thank you!
It’s going to be end of mine day, except before finish I am reading this enormous post to increase my knowledge.
I savor, lead to I found exactly what I used to be looking for. You have ended my 4 day long hunt! God Bless you man. Have a nice day. Bye
What’s up to all, the contents present at this site are really remarkable for people experience, well, keep up the nice work fellows.
Excellent post. I was checking continuously this blog and I am impressed! Very useful information specially the last part :) I care for such info a lot. I was seeking this particular info for a long time. Thank you and good luck.
Hi, I log on to your new stuff daily. Your story-telling style is awesome, keep doing what you’re doing!
Piece of writing writing is also a fun, if you know after that you can write or else it is complex to write.
I couldn’t resist commenting. Very well written!
Quality articles is the key to be a focus for the users to visit the website, that’s what this site is providing.
Hi to all, how is everything, I think every one is getting more from this site, and your views are pleasant for new users.
What’s up everyone, it’s my first go to see at this website, and piece of writing is truly fruitful in favor of me, keep up posting such articles or reviews.
When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Cheers!
I always spent my half an hour to read this webpage’s posts daily along with a cup of coffee.
I have been surfing online more than 3 hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. Personally, if all website owners and bloggers made good content as you did, the net will be much more useful than ever before.
I’m now not sure where you are getting your info, however good topic. I needs to spend a while studying more or working out more. Thank you for fantastic information I used to be in search of this information for my mission.
Thank you for sharing your info. I truly appreciate your efforts and I am waiting for your next post thank you once again.
Nice blog here! Also your site loads up fast! What host are you using? Can I get your affiliate link to your host? I wish my website loaded up as fast as yours lol
I’d like to find out more? I’d care to find out more details.
Thanks in favor of sharing such a pleasant thought, article is nice, thats why i have read it fully
Ищете надежного подрядчика для устройства стяжки пола в Москве? Обращайтесь к нам на сайт styazhka-pola24.ru! Мы предлагаем услуги по залитию стяжки пола любой сложности и площади, а также гарантируем быстрое и качественное выполнение работ.
снабжение объектов москва
Hi, this weekend is nice designed for me, because this occasion i am reading this enormous informative piece of writing here at my house.
Улучшайте интерьер дома с mehanizirovannaya-shtukaturka-moscow.ru. Машинная штукатурка поможет перемены быстро и без лишних усилий.
I was pretty pleased to find this web site. I want to to thank you for your time for this wonderful read!! I definitely savored every little bit of it and I have you book marked to see new stuff on your website.
An intriguing discussion is worth comment. I do believe that you should write more on this issue, it might not be a taboo subject but usually people don’t discuss such subjects. To the next! Kind regards!!
I read this post fully about the comparison of newest and preceding technologies, it’s remarkable article.
I constantly spent my half an hour to read this website’s articles every day along with a cup of coffee.
Asking questions are really pleasant thing if you are not understanding anything fully, except this article offers nice understanding even.
Хотите лучшего для своего дома? Механизированная штукатурка стен с mehanizirovannaya-shtukaturka-moscow.ru – это то, что вам нужно.
Awesome things here. I’m very glad to see your article. Thank you so much and I’m taking a look forward to touch you. Will you please drop me a mail?
Hi there, I found your blog via Google whilst searching for a comparable matter, your web site got here up, it seems to be good. I have bookmarked it in my google bookmarks.
Hi there to every body, it’s my first go to see of this website; this weblog includes awesome and actually good stuff in favor of readers.
Nice blog here! Also your website loads up fast! What host are you using? Can I get your affiliate link to your host? I wish my site loaded up as fast as yours lol
I think what you postedtypedsaidthink what you postedwrotesaidthink what you postedtypedsaidbelieve what you postedwroteWhat you postedwrote was very logicala lot of sense. But, what about this?think about this, what if you were to write a killer headlinetitle?content?typed a catchier title? I ain’t saying your content isn’t good.ain’t saying your content isn’t gooddon’t want to tell you how to run your blog, but what if you added a titleheadlinetitle that grabbed a person’s attention?maybe get people’s attention?want more? I mean %BLOG_TITLE% is a little vanilla. You ought to look at Yahoo’s home page and see how they createwrite news headlines to get viewers interested. You might add a video or a related picture or two to get readers interested about what you’ve written. Just my opinion, it could bring your postsblog a little livelier.
Woah! I’m really enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between user friendliness and visual appeal. I must say you have done a amazing job with this. In addition, the blog loads very fast for me on Safari. Outstanding Blog!
Does your site have a contact page? I’m having problems locating it but, I’d like to send you an e-mail. I’ve got some suggestions for your blog you might be interested in hearing. Either way, great site and I look forward to seeing it develop over time.
Heya! I just wanted to ask if you ever have any trouble with hackers? My last blog (wordpress) was hacked and I ended up losing a few months of hard work due to no backup. Do you have any solutions to protect against hackers?
Now I am going to do my breakfast, later than having my breakfast coming again to read further news.
Fabulous, what a website it is! This weblog gives useful information to us, keep it up.
Whats up are using WordPress for your blog platform? I’m new to the blog world but I’m trying to get started and create my own. Do you need any coding knowledge to make your own blog? Any help would be greatly appreciated!
I like what you guys are up too. This type of clever work and coverage! Keep up the fantastic works guys I’ve added you guys to our blogroll.
You can definitely see your expertise in the article you write. The world hopes for more passionate writers like you who aren’t afraid to mention how they believe. All the time go after your heart.
Greetings I am so excited I found your weblog, I really found you by mistake, while I was searching on Askjeeve for something else, Regardless I am here now and would just like to say cheers for a incredible post and a all round exciting blog (I also love the theme/design), I don’t have time to read through it all at the minute but I have book-marked it and also included your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the superb job.