| ||||||||||
Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
分治+人品A+B 做法简单,耗时很少 #include<cstdio> #include<cstdlib> #include<ctime> using namespace std; int main(){ srand(time(0)*time(0)); int a,b;long long l=0,r=(1<<31)-1,ans; scanf("%d%d",&a,&b); while(1){ ans=(rand()*rand())%r+l; if(ans>a+b)r=ans-l; else if(ans<a+b)l=ans; else{printf("%lld\n",ans);return 0;} } } 祝你在POJ快乐! Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator