题目传送门:http://poj.org/problem?id=1006
中文版题目:http://hzwer.com/3299.html
完全看不懂题,不过既然大家都说是模线性方程组,那就按照那样做咯!
中国剩余定理的话,看看wiki就明白啦:https://en.wikipedia.org/wiki/Chinese_remainder_theorem
#include<iostream> #include<cstdio> using namespace std; const int SGZ = 3; const int MAXN = 5; const int SUM = 23*28*33; int T,arr[]={0,28*33,23*33,23*28},ori[]={0,23,28,33},a[MAXN],d; void EX_GCD(int a, int b, int &x, int &y){ if (!b) x=1, y=0; else EX_GCD(b,a%b,y,x), y -= a/b*x; } inline int rev(int w, int MOD){ int ret,tmp; EX_GCD(w,MOD,ret,tmp); return ret; } int main(){ while (cin>>a[1]>>a[2]>>a[3]>>d && a[1] != -1) { int vout = 0; for (int i=1;i<=SGZ;i++) vout += a[i]*rev(arr[i],ori[i])*arr[i]; vout = ((vout-d)%SUM+SUM)%SUM; vout = vout?vout:SUM; printf("Case %d: the next triple peak occurs in %d days.\n",++T,vout); } return 0; }
I’ve been browsing online greater than three hours nowadays, but I
never discovered any interesting article like yours.
It’s pretty price enough for me. In my opinion, if all
site owners and bloggers made just right content material as
you probably did, the web shall be much more useful than ever before.
I quite like looking through an article that can make people think.
Also, thanks for permitting me to comment!
Good day I am so grateful I found your website, I really found you by mistake,
while I was looking on Aol for something else, Nonetheless I am here
now and would just like to say thank you for a tremendous post and a all round exciting blog (I also
love the theme/design), I don’t have time to look over it all
at the moment but I have book-marked it and also included your RSS feeds,
so when I have time I will be back to read much more, Please do keep up
the fantastic job.
What a data of un-ambiguity and preserveness
of valuable knowledge about unexpected emotions.
It’s awesome to pay a quick visit this web site and reading the
views of all mates on the topic of this article, while I am also keen of
getting knowledge.
This site was… how do I say it? Relevant!! Finally I have
found something which helped me. Thank you!
I am extremely impressed along with your writing skills as neatly as with the layout to your blog.
Is this a paid subject matter or did you customize it yourself?
Anyway keep up the excellent high quality writing, it’s rare to look a nice blog like this one nowadays..
Greetings I am so excited I found your weblog, I really found you by accident, while I was browsing on Bing for something
else, Anyways I am here now and would just like to say cheers for a fantastic
post and a all round enjoyable blog (I also love the theme/design), I
don’t have time to go through it all at the minute but I have saved it and
also included your RSS feeds, so when I have time I will be back to read more, Please do keep
up the excellent jo.
Now I am going to do my breakfast, once having my breakfast
coming over again to read additional news.
I’ve been browsing online greater than 3 hours these days, but I never discovered any interesting article like yours. It is beautiful value enough for me. In my opinion, if all website owners and bloggers made excellent content as you did, the net will probably be a lot more helpful than ever before. “Learn to see in another’s calamity the ills which you should avoid.” by Publilius Syrus.
Thank you for the auspicious writeup. It in fact was a amusement account it.
Look advanced to far added agreeable from you! By the way, how could we communicate?
Unquestionably believe that which you stated.
Your favorite reason seemed to be on the internet
the simplest thing to be aware of. I say to you, I definitely get irked while people
think about worries that they just don’t know about.
You managed to hit the nail upon the top as well as defined out the whole thing without having side-effects , people could take
a signal. Will probably be back to get more.
Thanks
Howdy! Someone in my Facebook group shared this site with us so I came to check it out.
I’m definitely enjoying the information. I’m bookmarking and will be tweeting this to my followers!
Outstanding blog and excellent design and style.
Amazing! This blog looks just like my old one! It’s on a totally different topic but it has pretty much the
same layout and design. Great choice of colors!
Wow, superb blog format! How lengthy have you been blogging for?
you made running a blog glance easy. The entire look of
your web site is fantastic, let alone the content!
Hey just wanted to give you a quick heads up and let
you know a few of the images aren’t loading correctly.
I’m not sure why but I think its a linking issue.
I’ve tried it in two different web browsers and both show the same
results.
Definitely believe that which you stated.
Your favorite reason seemed to be on the internet the easiest thing to be aware of.
I say to you, I definitely get annoyed while people think about
worries that they just don’t know about. You managed
to hit the nail upon the top and also defined out the whole thing
without having side-effects , people could take a signal.
Will probably be back to get more. Thanks
Asking questions are really pleasant thing if you are not understanding something totally, except this post provides fastidious understanding yet.
Thanks for any other wonderful article. Where else could anybody get that kind of information in such an ideal approach
of writing? I’ve a presentation next week, and I’m on the search for such info.
Great article.
I loved as much as you will receive carried out right here. The sketch is attractive, your authored material stylish. nonetheless, you command get got an impatience over that you wish be delivering the following. unwell unquestionably come more formerly again as exactly the same nearly a lot often inside case you shield this increase.