#strange

poj 2891 Strange Way to Express Integers(中国剩余定理)

http://poj.org/problem?id=2891题意:求解一个数x使得x%8=7,x%11=9;   若x存在,输出最小整数解。否则输出-1;ps:思路:这不是简单的中国剩余定理问题,由于输入的ai不一定两两互质,而中国剩余定理的条件是除数两两互质。   这是一般的模线性方程组,对于    Xmodm1=r...
代码星球 代码星球·2021-02-13

poj1958——Strange Towers of Hanoi

Theteacherpointstotheblackboard(Fig.4)andsays:"Sohereistheproblem:Therearethreetowers:A,BandC.Therearendisks.Thenumbernisconstantwhileworkingthepuzzle.Alldisksa...

POJ2891 Strange Way to Express Integers 扩展欧几里德 中国剩余定理

  给出k个同余方程组:xmodai=ri。求x的最小正值。如果不存在这样的x,那么输出-1.不满足所有的ai互质。  UPD(2018-08-07):  本题做法为扩展中国剩余定理。  我写了一篇证明:链接:https://www.cnblogs.com/zhouzhendong/p/exCRT.html  代码就不...

hdu 1548 A strange lift (dijkstra)

AstrangeliftTimeLimit:2000/1000MS(Java/Others)   MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):32529   AcceptedSubmissio...