相关链接
题目传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2296
解题报告
我们假设高位是$9876543201$,低$6$位随意
那么每一次加上$x$,导致高位至多增加$1$
所以一定有解,至于是多少倍?我们可以二分
Code
#include<bits/stdc++.h> #define LL long long using namespace std; const LL MX = 9876543201999999; const LL MN = 9876543201000000; inline int read() { char c=getchar(); int f=1,ret=0; while (c<'0'||c>'9') {if(c=='-')f=-1;c=getchar();} while (c<='9'&&c>='0') {ret=ret*10+c-'0';c=getchar();} return ret * f; } int main() { for (int T = read(); T; T--) { LL x = read(); if (!x) { puts("-1"); } else { LL r = MX / x + 1, l = MN / x; while (l <= r) { LL mid = l + r >> 1; if (x * mid < MN) { l = mid + 1; } else if (x * mid > MX) { r = mid - 1; } else { printf("%lld\n", mid * x); break; } } } } return 0; }
After looking over a number of the blog posts on your
website, I seriously appreciate your technique of blogging.
I saved it to my bookmark website list and will be checking back in the near future.
Please check out my website too and let me know how you feel.
Thank you for another excellent article. The place else may anyone
get that kind of info in such a perfect means of writing?
I have a presentation subsequent week, and I am at the search for such info.
I every time emailed this blog post page to all my friends, for the reason that
if like to read it after that my friends will
too.
When some one searches for his essential thing, so he/she needs to be available that in detail, thus that thing is maintained
over here.
You’re so interesting! I don’t believe I have read a single thing like this
before. So great to discover someone with original thoughts
on this topic. Really.. thanks for starting this up. This web site is something that’s needed on the internet, someone with a little originality!
Hello, this weekend is nice in favor of me, because this occasion i am reading this impressive educational piece of writing here at my home.
Hi! This is kind of off topic but I need some guidance from an established blog.
Is it very difficult to set up your own blog?
I’m not very techincal but I can figure things
out pretty quick. I’m thinking about making my own but I’m not
sure where to begin. Do you have any ideas or suggestions?
Appreciate it
Asking questions are actually good thing if you are not understanding
anything totally, however this article gives nice understanding even.
I like the helpful info you provide in your articles.
I’ll bookmark your weblog and check again here frequently.
I am quite certain I will learn many new stuff right here!
Good luck for the next!
At this moment I am going to do my breakfast, once having my breakfast coming over again to read further news.
Great goods from you, man. I’ve have in mind your stuff
previous to and you’re just too fantastic. I actually like
what you have obtained right here, certainly like what
you are saying and the best way by which you say it.
You make it entertaining and you continue to take care of to stay it sensible.
I cant wait to learn far more from you. That is actually a wonderful site.
Keep this going please, great job!
Wow that was unusual. I just wrote an very long comment but after I clicked submit my comment didn’t show up.
Grrrr… well I’m not writing all that over again. Anyway, just wanted to say fantastic blog!
This is a very good tips especially to those new to blogosphere, brief and accurate information… Thanks for sharing this one. A must read article.
Hi there, i read your blog occasionally and i own a similar
one and i was just curious if you get a lot of spam remarks?
If so how do you protect against it, any plugin or anything you can advise?
I get so much lately it’s driving me insane so any help is very much appreciated.
That is a very good tip particularly to those fresh to the blogosphere.
Brief but very precise information… Thank you for sharing this one.
A must read article!
Very nice blog post. I absolutely love this website.
Keep writing!
I like the helpful info you provide in your articles.
I will bookmark your blog and check again here regularly. I’m
quite certain I will learn many new stuff right here!
Good luck for the next!
Wow, that’s what I was looking for, what a stuff!
present here at this weblog, thanks admin of this web page.
Superb, what a blog it is! This blog gives useful data to us, keep it
up.
I am sure this article has touched all the internet people, its really really good paragraph
on building up new website.
Hey this is kind of of off topic but I was
wanting to know if blogs use WYSIWYG editors or if you
have to manually code with HTML. I’m starting a blog soon but have no coding know-how so I wanted to get guidance from someone with experience.
Any help would be enormously appreciated!
Hello! I’ve been following your web site for a while now and finally
got the bravery to go ahead and give you a shout out from New
Caney Texas! Just wanted to mention keep up the excellent work!
Hi just wanted to give you a brief heads up and let you know a few of the pictures aren’t loading properly.
I’m not sure why but I think its a linking issue. I’ve tried it in two different browsers and both show
the same outcome.
Magnificent web site. Plenty of helpful information here. I?¦m sending it to several buddies ans also sharing in delicious. And of course, thank you in your effort!