摘要:问题:对于正整数a,b,求整数x,y满足: ax+by=gcd(a,b) 解法:ExtandedGCD 已知gcd(a,b)=gcd(b,a mod b); 设gcd(a,b)=d 假设已求出x1,y1满足bx1+(a mod b)y1=d(*) 因为a mod b=a-(a div b)*b(**) (**)代入(*)得: ay1+(x1-(a div b)*y1)b=d 所以x=y1 y=x1...
阅读全文
摘要:给大家推荐首歌EveryDAY Troy&GabrialaOnce in a lifetimeMeans there's no second chanceSo I believe that you and meShould grab it while we canMake it last foreverAnd never give it backIt's our turnAnd I'm loving where we're atBecause this moment's really all we haveEveryday of our live
阅读全文
摘要:1 { 2 二维线段标准相交问题 3 } 4 Program LineIntersect; 5 6 const 7 precision=1E-6; 8 9 Type 10 11 point=record12 x,y:double;13 end;14 15 Tdbl=-1..1;16 17 var18 p:array[1..4] of point;19 i:longint;20 Function dblcmp(d:double):Tdbl;//注意这里相当于一个过滤器,函数值只有三种-1,0,121 begin22 if abs(d)<precision t...
阅读全文
摘要:从今天起,我就在这里开始我的OI之旅了!1 Program RPplus;2 3 var4 rp:double;5 6 begin7 while 1=1 do8 inc(rp,maxlongint);9 end.
阅读全文