UVA 11878 - Homework Checker Solution

# LINK: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=979 count=0 while True: try: s=input() result=s.split('=') if result[0].find('+')>0: a,b=result[0].split('+') a=int(a) b=int(b) if result[1]!='?' and a+b==int(result[1]): count+=1 else: a,b=result[0].split('-') a=int(a) b=int(b) if result[1]!='?' and a-b==int(result[1]): count+=1 except EOFError: print(count) break

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.