Ejemplo n.º 1
0
def addtodict(uname):
    PROBS = spojuserdatagetter.getter(uname)
    for prob in PROBS:
        if prob in AVGACC:
            AVGACC[prob] = (AVGACC[prob] * 1.0 + PROBS[prob] * 1.0) / 2.0
        else:
            AVGACC[prob] = PROBS[prob] * 1.0
    print "Done for ", uname
Ejemplo n.º 2
0
def addtodict(uname):
     PROBS=spojuserdatagetter.getter(uname)
     for prob in PROBS:
         if prob in AVGACC:
                AVGACC[prob]=(AVGACC[prob]*1.0+PROBS[prob]*1.0)/2.0
         else:
                AVGACC[prob]=PROBS[prob]*1.0
     print "Done for ",uname
def main():
    global DIFFICULTYLEVEL
    DIFFICULTYLEVEL=0
    print "Enter you SPOJ username:"******"Getting your solved problem list"
    PROBS=spojuserdatagetter.getter(username)
    FILE=open("SPOJCLASS","r")
    FILECONTENT=FILE.read()
    FILECONTENT=FILECONTENT.split('\n')
    for i in FILECONTENT:
        i=i.split()
        if len(i) >= 2:
           SPOJCLASS[i[0]]=i[1:]
    FILE.close()
    FILE=open("SPOJDIFF","r")
    FILECONTENT=FILE.read()
    FILECONTENT=FILECONTENT.split('\n')
    for i in FILECONTENT:
        i=i.split()
        if len(i) >= 2:
           SPOJDIFF[i[0]]=i[1]
    FILE.close()
    FILE=open("SPOJPROB","r")
    FILECONTENT=FILE.read()
    FILECONTENT=FILECONTENT.split('\n')
    for i in FILECONTENT:
        i=i.split('|')
        if len(i)>=3:
         pname=i[2]
         PROBLIST[pname]=i[4]
    for prob in PROBS:
       if prob in SPOJCLASS:
          TAGS=SPOJCLASS[prob]
          for tag in TAGS:
             if tag not in TAGLIST:
                   TAGLIST[tag]=1
             else: 
                   TAGLIST[tag]=TAGLIST[tag]+1
    for prob in PROBS:
       if prob in SPOJDIFF:
        DIFFICULTYLEVEL=(DIFFICULTYLEVEL+(PROBS[prob]-float(SPOJDIFF[prob])))/2.0
    while 1==1:
     print "Your Difficulty Level:",DIFFICULTYLEVEL
     print "If difficulty level is 0, you are average, if its less than 0 , you are above average  and its greater than 0 , you are below average!"
     print "1) Pick A Fun to Solve problem"
     print "2) Pick A Problem to improve my weakness"
     print "3) Pick Problem Based on Difficulty Level"
     print "4) Exit"
     print "Enter Choice "
     needed=raw_input()
     CHOSEN=""
     SELECTED=[]
     if "1" in needed:
        CHOSEN,SELECTED=funtosolve(PROBS,"MAX")
     elif "2" in needed:
        CHOSEN,SELECTED=funtosolve(PROBS,"MIN")
     elif "3" in needed:
        CHOSEN,SELECTED=difficultybased(PROBS)
     else:
        break
     print "\n\n\nWe found the best match ! Please try the problem at this url","http://www.spoj.pl/problems/"+CHOSEN+"/"
     print "You can also try these"
     for i in range(min(5,len(SELECTED))):
        print "http://www.spoj.pl/problems/"+SELECTED[i]+"/"
     print "\n\n\n"
Ejemplo n.º 4
0
def main():
    global DIFFICULTYLEVEL, PROBCOUNT
    DIFFICULTYLEVEL = 0
    PROBCOUNT = 0
    print "Enter you SPOJ username:"******"Getting your solved problem list"
    PROBS = spojuserdatagetter.getter(username)
    FILE = open("SPOJCLASS", "r")
    FILECONTENT = FILE.read()
    FILECONTENT = FILECONTENT.split('\n')
    for i in FILECONTENT:
        i = i.split()
        if len(i) >= 2:
            SPOJCLASS[i[0]] = i[1:]
    FILE.close()
    FILE = open("SPOJDIFF", "r")
    FILECONTENT = FILE.read()
    FILECONTENT = FILECONTENT.split('\n')
    for i in FILECONTENT:
        i = i.split()
        if len(i) >= 2:
            SPOJDIFF[i[0]] = i[1]
    FILE.close()
    FILE = open("SPOJPROB", "r")
    FILECONTENT = FILE.read()
    FILECONTENT = FILECONTENT.split('\n')
    for i in FILECONTENT:
        i = i.split('|')
        if len(i) >= 3:
            pname = i[2]
            PROBLIST[pname] = i[4]
    for prob in PROBS:
        if prob in SPOJCLASS:
            TAGS = SPOJCLASS[prob]
            for tag in TAGS:
                if tag not in TAGLIST:
                    TAGLIST[tag] = 1
                else:
                    TAGLIST[tag] = TAGLIST[tag] + 1
    for prob in PROBS:
        if prob in SPOJDIFF:
            DIFFICULTYLEVEL += PROBS[prob] / ((1.0 + float(SPOJDIFF[prob]))**2)
            #print "difficultyLevel:", DIFFICULTYLEVEL
            #print "PROBDATA:", PROBS[prob]
            #print "SPOJDIFF_DATA:", float(SPOJDIFF[prob])
            PROBCOUNT = PROBCOUNT + 1
    DIFFICULTYLEVEL = DIFFICULTYLEVEL / (PROBCOUNT + 1)
    if DIFFICULTYLEVEL == 0:
        print "You have not attempted any problems yet. Try this one: http://www.spoj.com/TEST"
    while 1 == 1:
        print "Your Difficulty Level:", math.pow(DIFFICULTYLEVEL, -1)
        print "You've solved " + str(
            PROBCOUNT) + " problems, challenge and classical inclusive!"
        print "Fun facts:"
        print "You start out with a difficulty level of 1"
        print "Scores more than 1 indicate that you are above average, while scores below 1 suggest that you are below average"
        print "Happy Tree Friends is a cool show."
        print "Choose from the following:"
        print "1) Pick A Fun to Solve problem"
        print "2) Pick A Problem to improve my weakness"
        print "3) Pick Problem Based on Difficulty Level"
        print "4) Exit"
        print "Enter Choice "
        needed = raw_input()
        CHOSEN = ""
        SELECTED = []
        if "1" in needed:
            CHOSEN, SELECTED = funtosolve(PROBS, "MAX")
        elif "2" in needed:
            CHOSEN, SELECTED = funtosolve(PROBS, "MIN")
        elif "3" in needed:
            CHOSEN, SELECTED = difficultybased(PROBS)
        else:
            break
        print "\n\n\nWe found the best match ! Please try the problem at this url", "http://www.spoj.com/problems/" + CHOSEN + "/"
        print "You can also try these"
        for i in range(min(5, len(SELECTED))):
            print "http://www.spoj.com/problems/" + SELECTED[i] + "/"
        print "\n\n\n"
def main():
    global DIFFICULTYLEVEL
    DIFFICULTYLEVEL = 0
    print "Enter you SPOJ username:"******"Getting your solved problem list"
    PROBS = spojuserdatagetter.getter(username)
    FILE = open("SPOJCLASS", "r")
    FILECONTENT = FILE.read()
    FILECONTENT = FILECONTENT.split('\n')
    for i in FILECONTENT:
        i = i.split()
        if len(i) >= 2:
            SPOJCLASS[i[0]] = i[1:]
    FILE.close()
    FILE = open("SPOJDIFF", "r")
    FILECONTENT = FILE.read()
    FILECONTENT = FILECONTENT.split('\n')
    for i in FILECONTENT:
        i = i.split()
        if len(i) >= 2:
            SPOJDIFF[i[0]] = i[1]
    FILE.close()
    FILE = open("SPOJPROB", "r")
    FILECONTENT = FILE.read()
    FILECONTENT = FILECONTENT.split('\n')
    for i in FILECONTENT:
        i = i.split('|')
        if len(i) >= 3:
            pname = i[2]
            PROBLIST[pname] = i[4]
    for prob in PROBS:
        if prob in SPOJCLASS:
            TAGS = SPOJCLASS[prob]
            for tag in TAGS:
                if tag not in TAGLIST:
                    TAGLIST[tag] = 1
                else:
                    TAGLIST[tag] = TAGLIST[tag] + 1
    for prob in PROBS:
        if prob in SPOJDIFF:
            DIFFICULTYLEVEL = (DIFFICULTYLEVEL +
                               (PROBS[prob] - float(SPOJDIFF[prob]))) / 2.0
    while 1 == 1:
        print "Your Difficulty Level:", DIFFICULTYLEVEL
        print "If difficulty level is 0, you are average, if its less than 0 , you are above average  and its greater than 0 , you are below average!"
        print "1) Pick A Fun to Solve problem"
        print "2) Pick A Problem to improve my weakness"
        print "3) Pick Problem Based on Difficulty Level"
        print "4) Exit"
        print "Enter Choice "
        needed = raw_input()
        CHOSEN = ""
        SELECTED = []
        if "1" in needed:
            CHOSEN, SELECTED = funtosolve(PROBS, "MAX")
        elif "2" in needed:
            CHOSEN, SELECTED = funtosolve(PROBS, "MIN")
        elif "3" in needed:
            CHOSEN, SELECTED = difficultybased(PROBS)
        else:
            break
        print "\n\n\nWe found the best match ! Please try the problem at this url", "http://www.spoj.pl/problems/" + CHOSEN + "/"
        print "You can also try these"
        for i in range(min(5, len(SELECTED))):
            print "http://www.spoj.pl/problems/" + SELECTED[i] + "/"
        print "\n\n\n"
def main():
    global DIFFICULTYLEVEL, PROBCOUNT
    DIFFICULTYLEVEL=0
    PROBCOUNT=0
    print "Enter you SPOJ username:"******"Getting your solved problem list"
    PROBS=spojuserdatagetter.getter(username)
    FILE=open("SPOJCLASS","r")
    FILECONTENT=FILE.read()
    FILECONTENT=FILECONTENT.split('\n')
    for i in FILECONTENT:
        i=i.split()
        if len(i) >= 2:
           SPOJCLASS[i[0]]=i[1:]
    FILE.close()
    FILE=open("SPOJDIFF","r")
    FILECONTENT=FILE.read()
    FILECONTENT=FILECONTENT.split('\n')
    for i in FILECONTENT:
        i=i.split()
        if len(i) >= 2:
           SPOJDIFF[i[0]]=i[1]
    FILE.close()
    FILE=open("SPOJPROB","r")
    FILECONTENT=FILE.read()
    FILECONTENT=FILECONTENT.split('\n')
    for i in FILECONTENT:
        i=i.split('|')
        if len(i)>=3:
         pname=i[2]
         PROBLIST[pname]=i[4]
    for prob in PROBS:
       if prob in SPOJCLASS:
          TAGS=SPOJCLASS[prob]
          for tag in TAGS:
             if tag not in TAGLIST:
                   TAGLIST[tag]=1
             else: 
                   TAGLIST[tag]=TAGLIST[tag]+1
    for prob in PROBS:
       if prob in SPOJDIFF:
            DIFFICULTYLEVEL+= PROBS[prob]/((1.0 + float(SPOJDIFF[prob]))**2)
            #print "difficultyLevel:", DIFFICULTYLEVEL
            #print "PROBDATA:", PROBS[prob]
            #print "SPOJDIFF_DATA:", float(SPOJDIFF[prob])
            PROBCOUNT = PROBCOUNT + 1
    DIFFICULTYLEVEL =  DIFFICULTYLEVEL/(PROBCOUNT + 1)
    if DIFFICULTYLEVEL == 0:
        print "You have not attempted any problems yet. Try this one: http://www.spoj.com/TEST"
    while 1==1:
     print "Your Difficulty Level:", math.pow(DIFFICULTYLEVEL, -1)
     print "You've solved "+str(PROBCOUNT)+" problems, challenge and classical inclusive!"
     print "Fun facts:"
     print "You start out with a difficulty level of 1"
     print "Scores more than 1 indicate that you are above average, while scores below 1 suggest that you are below average"
     print "Happy Tree Friends is a cool show."
     print "Choose from the following:"
     print "1) Pick A Fun to Solve problem"
     print "2) Pick A Problem to improve my weakness"
     print "3) Pick Problem Based on Difficulty Level"
     print "4) Exit"
     print "Enter Choice "
     needed=raw_input()
     CHOSEN=""
     SELECTED=[]
     if "1" in needed:
        CHOSEN,SELECTED=funtosolve(PROBS,"MAX")
     elif "2" in needed:
        CHOSEN,SELECTED=funtosolve(PROBS,"MIN")
     elif "3" in needed:
        CHOSEN,SELECTED=difficultybased(PROBS)
     else:
        break
     print "\n\n\nWe found the best match ! Please try the problem at this url","http://www.spoj.com/problems/"+CHOSEN+"/"
     print "You can also try these"
     for i in range(min(5,len(SELECTED))):
        print "http://www.spoj.com/problems/"+SELECTED[i]+"/"
     print "\n\n\n"