3106: [cqoi2013]棋盘游戏
3144: [Hnoi2013]切糕

3119: Book

高橋直樹 posted @ 2013年4月18日 08:24 in BZOJ with tags bzoj , 2228 阅读

http://www.lydsy.com/JudgeOnline/problem.php?id=3119

RunID User Problem Result Memory Time Language Code_Length Submit_Time
393153 Liu_Ts 3119 Accepted 904 kb 328 ms C++ 504 B 2013-04-18 07:59:10

 

题意

要求构造一个序列,

满足,长度为N,和为M,第一个数是X,

从第二项开始一定比前一项大A或比前一项小B;

保证有解。

题解

如果在第i个位置上+A,他会对所有i以后(N-i+1)个数造成影响,

即对和造成的影响是+(N-i+1)*A

那么设+A操作总共对x个数造成影响,-B操作总共对y个数造成影响。

列得:

     xA-yB=M-N*X;

     x+y=n*(n-1)/2;

可以把x、y解出来。

问题就变成了用1..n-1之间的数去凑x或者y。

就从n-1开始,不断减小x就可以了。

 

#include<cstdio>
#include<cstring>
using namespace std;
long long N,M,n,m,x,y,X,A,B;
bool f[100011];
int main()
{
	scanf("%lld%lld%lld%lld%lld",&N,&X,&A,&B,&M);
	m=M-N*X;n=N*(N-1)/2;
	x=(m+B*n)/(A+B);y=n-x;
	int now=N-1;
	while(x)
	{
		if (x-now>=0)
			f[now]=1,x-=now;
		now--;
	}
	printf("%lld",X);
	for(int i=N-1;i>=1;i--)
	{
		if(f[i]) X+=A;else X-=B;
		printf(" %lld",X);
	}
	puts("");
}

 

seo service UK 说:
2023年11月01日 18:03

wow this saintly however ,I love your enter plus nice pics might be part personss negative love being defrent mind total poeple

메이저놀이터코드 说:
2023年12月07日 15:17

Today, I went to the beachfront with my kids. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is completely off topic but I had to tell someone!|

벨라벳 도메인 说:
2023年12月07日 15:19

I think this is one of the most vital info for me. And i’m glad studying your article. However should observation on few general things, The web site style is perfect, the articles is in reality excellent : D. Just right activity, cheers| This is a topic which is near to my heart… Take care! Exactly where are your contact details though?|

시스템배팅사이트 说:
2023年12月07日 15:49

Today, I went to the beachfront with my kids. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is completely off topic but I had to tell someone!|

먹튀폴리스주소 说:
2023年12月07日 15:55

We are a group of volunteers and starting a new scheme in our community. Your site provided us with helpful info to work on. You have performed a formidable activity and our entire neighborhood will be thankful to you.| I just want to mention I am new to blogging and site-building and really savored this blog site. Very likely I’m likely to bookmark your blog post . You surely come with tremendous article content. Appreciate it for sharing with us your web-site.

원엑스벳가입방법 说:
2023年12月07日 15:57

Good day, I just hopped over in your web site via StumbleUpon. Not something I would generally read, but I favored your emotions none the less. Thank you for making something value reading.if you are not eating much fiber, then you will always get indigestion. so eat lots of dietary fibers’

엔트리파워볼 说:
2023年12月07日 16:05

I am extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you customize it yourself? Either way keep up the nice quality writing, it’s rare to see a great blog like this one these days.| Informative, pretty much as I had come to expect from this site.

안전토토사이트 说:
2023年12月07日 16:35

Good day, I just hopped over in your web site via StumbleUpon. Not something I would generally read, but I favored your emotions none the less. Thank you for making something value reading.if you are not eating much fiber, then you will always get indigestion. so eat lots of dietary fibers’

먹튀검증 说:
2023年12月07日 17:03

Hi there I am so excited I found your webpage, I really found you by error, while I was researching on Askjeeve for something else, Anyhow I am here now and would just like to say thank you for a incredible post and a all round interesting blog (I also love the theme/design), I don’t have time to look over it all at the minute but I have saved it and also added in your RSS feeds, so when I have time I will be back to read much more, Please do keep up the awesome work.|

사설토토 说:
2023年12月07日 17:09

Hey! Someone in my Facebook group shared this website with us so I came to give it a look. I’m definitely loving the information. I’m book-marking and will be tweeting this to my followers! Terrific blog and amazing design.| You reported this exceptionally well! fda kratom

우리카지노 说:
2023年12月07日 17:26

Do you mind if I quote a couple of your articles as long as I provide credit and sources back to your website? My website is in the very same area of interest as yours and my users would certainly benefit from some of the information you provide here. Please let me know if this alright with you. Thanks a lot!|

토토사이트 说:
2023年12月07日 17:31

Excellent post. I was checking continuously this weblog and I’m inspired! Very useful information specifically the remaining phase  I deal with such info much. I used to be seeking this certain info for a very long time. Thank you and good luck. |I was suggested this website by my cousin. I am not sure whether this post is written by him as no one else know such detailed about my difficulty. You’re wonderful! Thanks!|

룸카지노주소 说:
2023年12月07日 17:46

It’s the best time to make a few plans for the longer term and it is time to be happy. I have learn this post and if I may just I wish to counsel you few attention-grabbing issues or advice. Maybe you can write next articles relating to this article. I wish to read even more things approximately it!|

도깨비 说:
2023年12月07日 17:46

Hello, Neat post. There’s a problem along with your web site in internet explorer, would test this? IE nonetheless is the market leader and a huge element of folks will pass over your great writing due to this problem.|so I only wanted to offer a fast shout out and claim I genuinely enjoy studying your articles. Could you suggest any other blogs/websites/forums that will deal with the identical subjects? Thanks.

사설먹튀검증 说:
2023年12月07日 18:19

Hi there I am so excited I found your webpage, I really found you by error, while I was researching on Askjeeve for something else, Anyhow I am here now and would just like to say thank you for a incredible post and a all round interesting blog (I also love the theme/design), I don’t have time to look over it all at the minute but I have saved it and also added in your RSS feeds, so when I have time I will be back to read much more, Please do keep up the awesome work.|

보증업체 说:
2023年12月07日 18:45

I am extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you customize it yourself? Either way keep up the nice quality writing, it’s rare to see a great blog like this one these days.| Informative, pretty much as I had come to expect from this site.

온라인카지노검증 说:
2023年12月07日 18:46

it is a really nice point of view. I usually meet people who rather say what they suppose others want to hear. Good and well written! I will come back to your site for sure!I was reading through some of your blog posts on this website and I conceive this website is rattling instructive! Retain posting.

메이저사이트 说:
2023年12月07日 19:00

Nice post. I discover something tougher on various blogs everyday. Most commonly it is stimulating to see content off their writers and practice a little there. I’d would prefer to use some using the content on my own weblog whether you do not mind. Natually I’ll supply you with a link with your web blog. Thanks for sharing.

파워볼사이트 说:
2023年12月07日 19:08

I have to express some thanks to you for bailing me out of this challenge. After scouting throughout the internet and coming across concepts which were not powerful, I was thinking my entire life was done. Living devoid of the answers to the issues you have sorted out as a result of your article content is a crucial case, as well as the kind that would have badly damaged my entire career if I hadn’t encountered your blog. Your primary knowledge and kindness in controlling almost everything was precious. I am not sure what I would have done if I had not encountered such a subject like this.

메이저 가입코드 说:
2023年12月07日 19:13

I think this is one of the most vital info for me. And i’m glad studying your article. However should observation on few general things, The web site style is perfect, the articles is in reality excellent : D. Just right activity, cheers| This is a topic which is near to my heart… Take care! Exactly where are your contact details though?|

แทงบอลออนไลน์ 说:
2023年12月07日 19:17

you’re actually a just right webmaster. The web site loading pace is incredible. It seems that you are doing any unique trick. Moreover, The contents are masterpiece. you have done a wonderful job on this matter! you’re in point of fact a excellent webmaster. The web site loading velocity is amazing. It sort of feels that you’re doing any unique trick. Also, The contents are masterpiece. you’ve done a wonderful job on this matter!

토토사이트추천 说:
2023年12月07日 19:28

Today, I went to the beachfront with my kids. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is completely off topic but I had to tell someone!|

롤토토사이트추천 说:
2023年12月07日 19:40

I have to express some thanks to you for bailing me out of this challenge. After scouting throughout the internet and coming across concepts which were not powerful, I was thinking my entire life was done. Living devoid of the answers to the issues you have sorted out as a result of your article content is a crucial case, as well as the kind that would have badly damaged my entire career if I hadn’t encountered your blog. Your primary knowledge and kindness in controlling almost everything was precious. I am not sure what I would have done if I had not encountered such a subject like this.

카지노프렌즈 说:
2023年12月07日 20:02

Today, I went to the beachfront with my kids. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is completely off topic but I had to tell someone!|

메이저사이트 说:
2023年12月07日 20:11

Good day, I just hopped over in your web site via StumbleUpon. Not something I would generally read, but I favored your emotions none the less. Thank you for making something value reading.if you are not eating much fiber, then you will always get indigestion. so eat lots of dietary fibers’

먹튀검증사이트 说:
2023年12月07日 20:24

Good day, I just hopped over in your web site via StumbleUpon. Not something I would generally read, but I favored your emotions none the less. Thank you for making something value reading.if you are not eating much fiber, then you will always get indigestion. so eat lots of dietary fibers’

메이저사이트 说:
2023年12月07日 20:29

We are a group of volunteers and starting a new scheme in our community. Your site provided us with helpful info to work on. You have performed a formidable activity and our entire neighborhood will be thankful to you.| I just want to mention I am new to blogging and site-building and really savored this blog site. Very likely I’m likely to bookmark your blog post . You surely come with tremendous article content. Appreciate it for sharing with us your web-site.

메이저사이트꽁머니 说:
2023年12月07日 20:48

Hey! Someone in my Facebook group shared this website with us so I came to give it a look. I’m definitely loving the information. I’m book-marking and will be tweeting this to my followers! Terrific blog and amazing design.| You reported this exceptionally well! fda kratom

온라인카지노종류 说:
2023年12月07日 20:56

Hi there I am so excited I found your webpage, I really found you by error, while I was researching on Askjeeve for something else, Anyhow I am here now and would just like to say thank you for a incredible post and a all round interesting blog (I also love the theme/design), I don’t have time to look over it all at the minute but I have saved it and also added in your RSS feeds, so when I have time I will be back to read much more, Please do keep up the awesome work.|

토토대표사이트추천 说:
2023年12月07日 21:25

Just wish to say your article is as amazing. The clarity in your post is just nice and i could assume you are an expert on this subject. Fine with your permission allow me to grab your RSS feed to keep updated with forthcoming post. Thanks a million and please continue the rewarding work.|

승인전화없는토토사이트 说:
2023年12月07日 21:26

I am extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you customize it yourself? Either way keep up the nice quality writing, it’s rare to see a great blog like this one these days.| Informative, pretty much as I had come to expect from this site.

벳365가입 说:
2023年12月07日 21:37

Hello, Neat post. There’s a problem along with your web site in internet explorer, would test this? IE nonetheless is the market leader and a huge element of folks will pass over your great writing due to this problem.|so I only wanted to offer a fast shout out and claim I genuinely enjoy studying your articles. Could you suggest any other blogs/websites/forums that will deal with the identical subjects? Thanks.

토토지존 说:
2023年12月07日 21:45

I am extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you customize it yourself? Either way keep up the nice quality writing, it’s rare to see a great blog like this one these days.| Informative, pretty much as I had come to expect from this site.

토토베이도메인 说:
2023年12月07日 21:49

Just wish to say your article is as amazing. The clarity in your post is just nice and i could assume you are an expert on this subject. Fine with your permission allow me to grab your RSS feed to keep updated with forthcoming post. Thanks a million and please continue the rewarding work.|

안전공원가입코드 说:
2023年12月07日 21:53

Hi 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 require any coding knowledge to make your own blog? Any help would be really appreciated!| I have read so many posts concerning the blogger lovers however this paragraph is in fact a fastidious article, keep it up.|

바카라게임 说:
2023年12月07日 22:00

Good – I should definitely pronounce, impressed with your web site. I had no trouble navigating through all the tabs as well as related info ended up being truly easy to do to access. I recently found what I hoped for before you know it in the least. Quite unusual. Is likely to appreciate it for those who add forums or something, web site theme . a tones way for your customer to communicate. Excellent task.

토토사이트 说:
2024年1月20日 13:46

It doesn't make sense to spend that much pennies on using that when you can just have it also. I couldn't refer this a 'Leptitox killer'. You might have to be aware of all the fulfilling stuff you can do with this

토토사이트 说:
2024年1月20日 15:19

Awesome post! Blog Comment is a great way to exchange ideas

슬롯사이트 说:
2024年1月20日 15:51

it's really nice and meanful. it's really cool blog. Linking is very useful thing.you have really helped lots of people who visit blog and provide them usefull information

바카라사이트 说:
2024年1月20日 16:36

Great  post, you have pointed out some  fantastic  points , I  likewise  think  this s a very  wonderful website. 

온라인 카지노 说:
2024年1月20日 17:25

retty 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月20日 18:02

Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post.

바카라 커뮤니티 说:
2024年1月20日 18:35

retty 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月20日 18:55

I am always searching online for articles that can help me. There is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job!

토토사이트 说:
2024年1月20日 19:30

"I am genuinely pleased to glance at this web site posts which consists of
lots of helpful data, thanks for providing these information."

카지노사이트 说:
2024年1月20日 20:17

Good day,your writing style is great and i love it,

industrial outdoor s 说:
2024年1月20日 20:48

Excellent Post! For more information

카지노 说:
2024年1月20日 21:26

You delivered such an impressive piece to read, giving every subject enlightenment for us to gain information. Thanks for sharing such information with us due to which my several concepts have been cleared.

소액결제현금화 说:
2024年1月21日 13:45

I couldn’t have really asked for a more rewarding blog. You’re there to give excellent suggestions, going directly to the point for simple understanding of your target audience. You’re surely a terrific expert in this subject. Thank you for remaining there human beings like me.

스포츠중계 说:
2024年1月21日 15:32

I do not even understand how I finished up here, but I assumed this post used to be great. I do not recognize who you're but certainly you're going to a well-known blogger for those who are not already. Cheers

카지노사이트 说:
2024年1月21日 16:01

"Every weekend i used to visit this web page, because i want enjoyment,
for the reason that this this web site conations really nice funny material too."

스포츠중계 说:
2024年1月22日 16:25

Pleasant blog and totally exceptiona

마사지 说:
2024年1月24日 16:10

 am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work

토토사이트 说:
2024年1月24日 19:25

Great  post, you have pointed out some  fantastic  points , I  likewise  think  this s a very  wonderful website. 

카지노 说:
2024年1月26日 11:05

카지노 바카라사이트 우리카지노 카지노는 바카라, 블랙잭, 룰렛 및 슬롯 등 다양한 게임을 즐기실 수 있는 공간입니다. 게임에서 승리하면 큰 환호와 함께 많은 당첨금을 받을 수 있고, 패배하면 아쉬움과 실망을 느끼게 됩니다.

하노이 밤문화 说:
2024年1月26日 11:09

하노이 꼭 가봐야 할 베스트 업소 추천 안내 및 예약, 하노이 밤문화 에 대해서 정리해 드립니다. 하노이 가라오케, 하노이 마사지, 하노이 풍선바, 하노이 밤문화를 제대로 즐기시기 바랍니다. 하노이 밤문화 베스트 업소 요약 베스트 업소 추천 및 정리.

마사지 说:
2024年1月27日 13:57

Wow, superb blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your site is magnificent, as well as the content!

무료스포츠중계 说:
2024年1月27日 14:12

Acknowledges for paper such a beneficial composition, I stumbled beside your blog besides decipher a limited announce. I want your technique of inscription..

토토사이트 说:
2024年1月27日 14:28

I basically need to reveal to you that I am new to weblog and certainly enjoyed this blog webpage. Likely I'm going to bookmark your blog . You totally have superb stories. Supports imparting to us your blog.

먹튀검증 说:
2024年1月29日 10:18

No.1 먹튀검증 사이트, 먹튀사이트, 검증사이트, 토토사이트, 안전사이트, 메이저사이트, 안전놀이터 정보를 제공하고 있습니다. 먹튀해방으로 여러분들의 자산을 지켜 드리겠습니다. 먹튀검증 전문 커뮤니티 먹튀클린만 믿으세요!!

베트남 밤문화 说:
2024年1月29日 10:22

베트남 남성전용 커뮤니티❣️ 베트남 하이에나 에서 베트남 밤문화를 추천하여 드립니다. 베트남 가라오케, 베트남 VIP마사지, 베트남 이발관, 베트남 황제투어 남자라면 꼭 한번은 경험 해 봐야할 화끈한 밤문화로 모시겠습니다.

Coin exchange 说:
2024年6月03日 13:59

The tech-original mission is to help you better understand technology, and make better decisions in the fields of IT, Tech, and Crypto.
https://www.tech-original.com/

Coin exchange 说:
2024年6月07日 18:36

The tech-original mission is to help you better understand technology, and make better decisions in the fields of IT, Tech, and Crypto.
https://www.tech-original.com/


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter