Created
December 16, 2018 02:47
-
-
Save ducnhse130201/90a7a77da2333e506ebb183c33aaf8c3 to your computer and use it in GitHub Desktop.
matesS3R2(math_master.py)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from telnetlib import * | |
r = Telnet('125.235.240.166', 12346) | |
r.read_until('r = ') | |
r_ = int(r.read_until(' and ').strip(' and ')) | |
r.read_until('p = ') | |
p = int(r.read_until('\n').strip()) | |
def find_a_b_c(r,p): | |
arr = [] | |
for i in range(r, p+1): | |
arr.append(i*i % p) | |
for i in range(len(arr)): | |
for j in range(len(arr)): | |
x = arr[i] | |
y = arr[j] | |
if x+y in arr: | |
a = i + r | |
b = j + r | |
c = arr.index(x+y) + r | |
return a,b,c | |
a,b,c = find_a_b_c(r_,p) | |
send_ = str(a) + ' ' + str(b) + ' ' + str(c) | |
r.write(send_ + '\n') | |
r.interact() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment