【BZOJ 1799】[Ahoi2009] self 同类分布

题目传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1799

就是枚举模数然后搞一搞数位DP
%NanoApe,随便减一下枝就可以Rank1了:http://nanoape.is-programmer.com/posts/193348.html

#include<bits/stdc++.h>
#define LL long long
using namespace std;

int MOD,sta[20];
LL f[20][170][170];

LL DFS(int t, int sum, int mod, bool lim) {
	if (sum > MOD) return 0;
	else if (!t) {
		return sum == MOD && !mod;		
	} else if (!lim && ~f[t][sum][mod]) {
		return f[t][sum][mod];
	} else {
		LL ret = 0;
		for (int i=0,ty=(lim?sta[t]:9);i<=ty;i++) {
			ret += DFS(t-1, sum+i, (mod*10+i)%MOD, lim&&i==sta[t]);
		}
		return lim? ret: f[t][sum][mod] = ret;
	}
}

inline LL cal(LL lim) {
	int cnt = 0;
	while (lim) {
		sta[++cnt] = lim % 10;
		lim /= 10;
	}
	if (cnt*9 < MOD) return 0;
	else return DFS(cnt,0,0,1);
}

int main(){
	LL a,b,vout=0; cin>>a>>b;
	for (int i=1;i<=162;i++) {
		memset(f,-1,sizeof(f));
		MOD = i;
		vout += cal(b);
		vout -= cal(a-1);
	}
	printf("%lld\n",vout);
	return 0;
}

315 thoughts to “【BZOJ 1799】[Ahoi2009] self 同类分布”

  1. Fine way of explaining, and fastidious piece of writing to obtain information on the topic of my presentation subject matter, which i
    am going to deliver in academy.

  2. Does your website have a contact page? I’m having trouble locating it but, I’d like to shoot you an e-mail.
    I’ve got some ideas for your blog you might be
    interested in hearing. Either way, great website and I look forward
    to seeing it improve over time.

  3. I was suggested this blog by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my problem.

    You’re wonderful! Thanks!

  4. Hey! This is my 1st comment here so I just wanted to give a quick shout out and say I genuinely enjoy reading through your posts.
    Can you suggest any other blogs/websites/forums that cover the same topics?

    Many thanks!

  5. Hi! I realize this is somewhat off-topic but I had to ask.
    Does operating a well-established blog like yours require a
    large amount of work? I’m completely new to running a blog however
    I do write in my diary daily. I’d like to start a blog so I can share my experience and thoughts
    online. Please let me know if you have any recommendations or tips for new aspiring blog owners.
    Appreciate it!

  6. My spouse and I stumbled over here from a different website and thought I might check things out.
    I like what I see so i am just following you. Look forward to finding out about your web page repeatedly.

  7. You really make it seem really easy with your presentation but I find this topic to
    be really something that I think I might by
    no means understand. It seems too complicated and extremely huge
    for me. I’m looking ahead for your next publish, I’ll attempt to get the grasp of it!

  8. Heya i am for the first time here. I found this board and I find It really
    useful & it helped me out much. I hope to give something back and aid others
    like you aided me.

  9. I think that is one of the so much important info for me.
    And i am glad reading your article. But wanna remark on few normal things, The web site taste is great,
    the articles is truly nice : D. Excellent process, cheers

  10. Hi there everyone, it’s my first go to see at this website, and article is truly fruitful
    in support of me, keep up posting such content.

  11. Ahaa, its fastidious discussion concerning
    this paragraph here at this website, I have read all that, so
    at this time me also commenting here.

  12. It’s good to come across a blog every once in a while that isn’t the same unswanted rehashed information. Excellent read! I’ve saved your site and I’m adding your RSS feeds to my Google account.

  13. Very nice post. I just stumbled upon your weblog and wished to say that I’ve really enjoyed surfing around your blog posts. After all I will be subscribing to your feed and I hope you write again very soon!

  14. My countless comments are like a sinking sea, without a response. There is no longer your footprint in the space, but in my heart, you still occupy an important position, and hesitate to leave.

  15. naturally like your web site however you have to check the
    spelling on several of your posts. Many of them are rife with spelling problems and I find it very
    troublesome to inform the reality on the other hand I will
    surely come again again.

  16. After looking over a handful of the articles on your web page,
    I really like your technique of blogging. I added it to my bookmark webpage list
    and will be checking back in the near future. Please check out my
    website too and tell me your opinion.

  17. I do agree with all the ideas you’ve presented in your post. They are really convincing and will definitely work. Still, the posts are too short for novices. Could you please extend them a bit from next time? Thanks for the post.

  18. *Great post however , I was wanting to know if you could write a litte more on this subject? I’d be very thankful if you could elaborate a little bit further. Bless you!

  19. of course like your web-site but you have to take a look at the spelling on severalof your posts. A number of them are rife with spelling issues and I to find it very troublesome to tell the reality on the other handI’ll surely come again again.

  20. AwesomeTremendousRemarkableAmazing thingsissues here. I’mI am very satisfiedgladhappy to peerto seeto look your articlepost. Thank youThanks so mucha lot and I’mI am taking a looklookinghaving a look forwardahead to touchcontact you. Will you pleasekindly drop me a maile-mail?

  21. 채팅방 |친목 |만남사이트 |외로움 |CHAT |헌팅 |솔로 |무료채팅 |펜팔 |소개팅어플순위 |중개 |채팅어플 |중년 |만남 |소모임어플 |채팅사이트 |교제 |쪽지 |커플 |번개 |소개팅어플 |연인 |심심할때할만한것 |채팅 |남자소개팅옷 |채팅앱추천 |낯선사람과의대화 |데이트메이트 |유부녀남자친구 |번개팅 |무료만남어플 |이성친구 |카톡친구 |무료소개팅어플 |무료채팅어플 |눈팅 |사교춤 |급만남 |카페채팅 |심쿵어플 |CHATTING |돌싱카페 |오픈채팅방 |국제연애 |채팅앱 |체팅 |외국인친구사귀기 |여의도데이트 |중년채팅 |만남어플 |벙개 |하늘사랑채팅 |세이클럽타키 |무료채팅사이트 |여자꼬시는법 |심쿵소개팅 |해운대헌팅 |혼술집 |여자친구데이트 |은하수다방 |부산헌팅 |성인채팅 |골프조인방 |무료체팅 |앤조이 |카톡친구만들기 |부산채팅 |유료채팅 |건전한채팅 |아줌마채팅 |클럽채팅 |아바타채팅 |낯선사람과대화하기 |무료채팅추천 |광주채팅 |채팅사이트추천 |인터넷채팅사이트 |여자채팅 |이성채팅 |골프조인사이트 |제주채팅 |추천채팅 |채팅게임 |울산채팅 |지역별채팅 |소개팅남자옷 |건전한채팅사이트 |건전채팅 |분당산악회 |인천채팅 |등산회 |인기채팅사이트 |즉시만남 |출장대행 |만남앱 |중년취미 |20대채팅 |분당모임 |대구채팅 |인터넷채팅방 |재미교포결혼 |즐거운만남 |채팅방사이트 |완전무료채팅 |채팅만남사이트 |배트남여성 |지역채팅 |라이브채팅 |일대일채팅 |인기채팅 |미팅어플 |실시간대화 |주말동호회 |30대채팅 |돌싱소개팅 |즉석미팅 |무료만남 |일대일미팅 |챗팅 |중년소개팅 |여자만나는방법 |남친구함 |무료만남사이트 |킹카클럽 |아줌마만남 |커플메니저 |소개팅카페 |여자만나는법 |오프라인미팅 |인터넷음악방송 |결혼방법 |결혼상담관리사 |매칭사이트 |여자소개팅 |30대미팅 |남자친구사귀는법 |40대채팅 |소셜데이팅 |채팅싸이트 |채팅추천 |BJ방송 |20대미팅 |무료소개팅사이트 |부부만남 |무료재혼사이트 |쳇팅사이트 |부산미팅 |수원만남 |실시간만남 |만남채팅 |대구미팅 |체팅사이트 |소개팅주선 |등산모임 |청주결혼정보업체 |평일여행 |친구사귀기 |무료결혼상담소 |새로운만남 |무료소개팅 |남자친구구함 |남여만남 |40대미팅 |돌싱까페 |대구돌싱 |30대소개팅사이트 |실시간채팅 |40대만남 |인터넷소개팅 |만남주선사이트 |여친구함 |여자만나기 |여자만남 |인터넷채팅 |만남사이트추천 |채팅창 |울산만남 |채팅만남 |대화방 |여친구하기 |4050 |중매쟁이 |여자친구구함 |광주미팅 |주말산행 |매너만남 |인천만남 |이성친구만들기 |여자친구소개 |온라인채팅 |대전만남 |20대소개팅사이트 |40대모임 |컴퓨터채팅 |당일만남 |구미결혼정보회사 |커플만들기 |이성친구찾기 |소개팅미팅 |단체모임 |소개팅싸이트 |대구만남 |골프모임 |제주만남 |대학생소개팅 |광주만남 |번개만남 |중년모임 |대전미팅 |인터넷만남 |애인만들기 |만남주선 |3040미팅 |지역만남 |이성찾기 |애인만들기사이트 |서울미팅 |50대만남 |포항소개팅 |이성만남 |애인찾기 |돌싱동호회 |대학생미팅 |솔로탈출 |음악카페 |인연찾기 |미팅사이트 |여자친구사귀고싶어요 |모바일채팅 |애인구하기 |중년카페 |중년남성 |챗 |50대채팅 |만남싸이트 |소셜데이트 |채팅하기 |중년만남 |친구만남 |체팅싸이트 |이성교제 |제주결혼 |전북결혼정보회사 |인천결혼정보업체 |셀프소개팅 |맞선의상 |노인재혼 |기독교결혼 |결혼대행업체 |가톨릭결혼 |50대싱글모임 |포항결혼 |솔로여행 |커플메이커 |번팅 |40대채팅사이트 |연애사이트 |3040만남 |40대소개팅 |미팅카페 |10대채팅 |40대노총각 |공짜채팅 |무료챗팅 |중년채팅방 |무료채팅방 |청주채팅 |성인소개팅 |채팅방추천 |실시간체팅 |조이채팅 |음악채팅 |무료채팅창 |즉석만남 |데이트알바 |엔조이사이트 |벙개모임 |인터넷무료채팅 |성인만남사이트 |아이폰낯선사람 |낯선사람과의대화포인트버그 |가가라이브사진 |가가라이브신고 |가가라이브위치추적 |가가홈런 |가가랑ㅣ브 |가가라이브어플 |라인여자 |가가라이브인증 |가가라이브라인 |가가라이브신상 |가가라이브정지 |가가라이브 |포인트없는만남 |결제없는소개팅어플 |포인트없는만남사이트 |결제없는만남 |채팅 |가가라이브같은 |가가라이브여자 |가가라이브2 |가가라이브레전드 |가가런 |무료번개 |가가라이브3 |가가라이브같은곳

  22. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You clearly know what youre talking about, why throw away your intelligence on just posting videos to your blog when you could be giving us something enlightening to read?|

  23. Thanks for your marvelous posting! I truly enjoyed reading it, you are a great author. I will ensure that I bookmark your blog and will eventually come back someday. I want to encourage you to ultimately continue your great writing, have a nice afternoon!|

  24. Oh my goodness! Awesome article dude! Thank you so much, However I am encountering problems with your RSS. I don’t know the reason why I cannot subscribe to it. Is there anyone else having identical RSS issues? Anybody who knows the answer can you kindly respond? Thanks!!|

  25. I seriously love your site.. Great colors & theme. Did you create this website yourself? Please reply back as I’m trying to create my own personal blog and would love to learn where you got this from or what the theme is named. Thanks!|

  26. Thank you for the auspicious writeup. It in fact was aamusement account it. Look advanced to far added agreeablefrom you! However, how could we communicate? minecraft free download 2018

  27. Wow that was odd. I just wrote an incredibly long comment but after Iclicked submit my comment didn’t show up. Grrrr… well I’m not writingall that over again. Anyway, just wanted to say great blog!

  28. Please let me know if you’re looking for a writer for your site. You have some really great articles and I feel I would be a good asset. If you ever want to take some of the load off, I’d really like to write some articles for your blog in exchange for a link back to mine. Please blast me an e-mail if interested. Kudos!|

  29. We are a group of volunteers and opening a new scheme in our community. Your site provided us with valuable information to work on. You have done a formidable job and our entire community will be thankful to you.|

Leave a Reply

Your email address will not be published. Required fields are marked *