Uva sollution:11219 - How old are you?

# https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=2160 n=input() while len(n)==0: n=input() n=int(n) c=0 while n: n=n-1 x=input() currentDate=input() birthDate=input() currentDate,currentMonth,currentYear=currentDate.split("/") birthDate,birthMonth,birthYear=birthDate.split("/") year=int(currentYear)-int(birthYear) month=int(currentMonth)-int(birthMonth) date=int(currentDate)-int(birthDate) if(month==0 and date<0): date=-1 else: date=0 if(month>=0): month=0 else: month=-1 res=year+month+date c=c+1 # print(year,month,date,res) if(res<0): print("Case #"+str(c)+":","Invalid birth date") elif(res>130): print("Case #"+str(c)+":","Check birth date") else: print("Case #"+str(c)+":",res)

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.