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 |
终于过了,WA了无数次~#生成小规模的随机测试数据的脚本, 过了之后如果还WA的话,就检查整数乘法是否overflow from random import randint ih = open("test", "w") oh = open("test.a", "w") for i in range(1000): x, z, k = randint(1, 1000), randint(1, 100), randint(1, 1000) k %= z for j in range(1001): if (x**j) % z == k: break if j>=z: oh.write("No Solution\n") else: oh.write(str(j)+'\n') ih.write(str(x)+" "+str(z)+" "+str(k)+"\n") ih.write("0 0 0\n") ih.close() oh.close() Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator