解题思路

111 3299700
128 599977
131 2450747
145 391019
153 761138
161 3176684
171 1003551
21 7226370
22 5434398
225 434398
23 2267328
232 267328
24 695678
246 95678
25 23780442
252 3780442
26 27317059
262 7317059
27 5467080
275 467080
28 29809827
282 9809827
29 26390704
292 6390704
30 17873869
301 7873869
31 14721075
311 4721075
32 1372179
321 372179
33 14817463
331 4817463
34 31547143
343 1547143
35 34968993
353 4968993
36 37464447
363 7464447
37 12293791
371 2293791
38 9677619
389 677619
39 43454454
394 3454454
40 30507603
403 507603
41 19897960
411 9897960
42 15283817
421 5283817
43 34196578
433 4196578
44 433538
444 33538
45 7271208
457 271208
46 5028027
465 28027
47 39135126
473 9135126
48 8494352
488 494352
49 1249311
491 249311
50 6134928
506 134928
51 2783809
512 783809
52 3635226
523 635226
53 280654
532 80654
54 13667238
541 3667238
55 13186694
551 3186694
56 8634124
568 634124
57 8004032
578 4032
58 8247979
588 247979
59 18126857
591 8126857
60 13915423
601 3915423
61 1210930
611 210930
62 8138714
628 138714
63 9564551
639 564551
64 1244511
641 244511
65 23119562
652 3119562
66 4304644
664 304644
67 10439428
671 439428
 
 
http://www.qlcoder.com/task/7581
 
import hashlib
import requests
import sys
import json
def get(i):
    res=requests.get('http://www.qlcoder.com/train/handsomerank?_token=&user=&checkcode={}'.
                 format(i))
    if res.status_code!=200:
        sys.exit(1)

def set(i,result):
    result=json.dumps(result)
    with open(r'C:\Users\hzqt2\Desktop\test.txt','a') as f:
        f.writelines(str(i)+' '+str(result)+'\r\n')
result={111:3299700,128:599977,131:2450747,145:391019,153:761138,161:3176684,171:1003551,207:203924,217:226370}
for i in range(22,1001):
    if i in result.keys():
        get(result[i])
        continue
    x = 0
    while 1:
        md5=hashlib.md5('20190106slqt'+str(i)+str(x)).hexdigest()
        #print(md5,md5[0:6])
        if md5[0:6]=='000000':
            result.update({i:x})

            print i,x
            set(i, x)
            get(x)

            if i<100:
                result.update({i*10+int(str(x)[0]): int(str(x)[1:])})
                set(i*10+int(str(x)[0]),int(str(x)[1:]))
            break
            #
        x+=1

猜你喜欢

转载自www.cnblogs.com/slqt/p/10228956.html