Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

终于过了,WA了无数次~

Posted by lddlinan at 2020-05-04 23:08:32 on Problem 3243
#生成小规模的随机测试数据的脚本, 过了之后如果还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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator