Problem:

Grading

  Write a program which reads a list of student test scores and evaluates the performance for each student.

  The test scores for a student include scores of the midterm examination m (out of 50), the final examination f (out of 50) and the makeup examination r (out of 100). If the student does not take the examination, the score is indicated by -1.

  The final performance of a student is evaluated by the following procedure:

  
If the student does not take the midterm or final examination, the student's grade shall be F.

  
If the total score of the midterm and final examination is greater than or equal to 80, the student's grade shall be A.

  
If the total score of the midterm and final examination is greater than or equal to 65 and less than 80, the student's grade shall be B.

  
If the total score of the midterm and final examination is greater than or equal to 50 and less than 65, the student's grade shall be C.

  
If the total score of the midterm and final examination is greater than or equal to 30 and less than 50, the student's grade shall be D. However, if the score of the makeup examination is greater than or equal to 50, the grade shall be C.

  
If the total score of the midterm and final examination is less than 30, the student's grade shall be F.

Input

  The input consists of multiple datasets. For each dataset, three integers m, f and r are given in a line.

  The input ends with three -1 for m, f and r respectively. Your program should not process for the terminal symbols.

The number of datasets (the number of students) does not exceed 50.

Output

  For each dataset, print the grade (A, B, C, D or F) in a line.

Sample Input

40 42 -1
20 30 -1
0 2 -1
-1 -1 -1

Sample Output

A
C
F



Sample input:
40 42 -1
20 30 -1
0 2 -1
-1 -1 -1


Sample output:
A
C
F

Submission status: Accepted

Solution code:
def getGrade(m, f, r):
  grade = ""
  if m == -1 or f == -1:
    grade = "F"
  elif m + f >= 80:
    grade = "A"
  elif m + f >= 65:
    grade = "B"
  elif m + f >= 50:
    grade = "C"
  elif m + f >= 30:
    if r >= 50:
      grade = "C"
    else:
      grade = "D"
  else:
    grade = "F"
  return grade

while True:
  line = raw_input().split(" ")
  m = int(line[0])
  f = int(line[1])
  r = int(line[2])
  if m == -1 and f == -1 and r == -1:
    break
  else:
    print getGrade(m, f, r)

Submission status: Accepted

Solution code:
while 1:
    m,f,r=map(int, raw_input().split())
    if m==f==r==-1: break
    s=m+f
    if m==-1 or f==-1 or s<30: R="F"
    elif s>=80: R="A"
    elif s>=65: R="B"
    elif s>=50: R="C"
    elif r>=50: R="C"
    else: R="D"
    print R

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, input().strip().split())
    if m == f == r == -1: break
    if m == -1 or f == -1 or m + f < 30:
        print('F')
    elif m + f >= 80:
        print('A')
    elif m + f >= 65:
        print('B')
    elif m + f >= 50:
        print('C')
    elif m + f >= 30:
        print('C' if r >= 50 else 'D')

Submission status: Accepted

Solution code:
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Submission status: Accepted

Solution code:
while True:
	m,f,r=map(int,raw_input().split())
	if m==f==r==-1: break
	if m+f<30 or m==-1 or f==-1: print 'F'
	elif m+f>=80: print 'A'
	elif 65<=m+f: print 'B'
	elif 50<=m+f: print 'C'
	elif r>=50: print 'C'
	else: print 'D'

Submission status: Accepted

Solution code:
midExam, finalExam, reExam = list(map(int, input().split()))
addedResult = midExam + finalExam

while True :
    if midExam == -1 and finalExam == -1 and reExam == -1 :
        break;
    
    if midExam == -1 or finalExam == -1 or addedResult < 30 :
        print("F")
    elif addedResult >= 80 :
        print("A")
    elif addedResult >= 65 and addedResult < 80 :
        print("B")
    elif addedResult >= 50 and addedResult < 65 :
        print("C")
    elif addedResult >= 30 and addedResult < 50 :
        if reExam >= 50 :
            print("C")
        else :
            print("D")
    midExam, finalExam, reExam = list(map(int, input().split()))
    addedResult = midExam + finalExam

Submission status: Accepted

Solution code:
a = []
while True:
    b = map(int, raw_input().split())
    if b == [-1, -1, -1]:
        break
    a.append(b)
for list in a:
    m, f, r = list
    if m == -1 or f == -1:
        print 'F'
    elif m + f >= 80:
        print 'A'
    elif m + f >= 65:
        print 'B'
    elif m + f >= 50:
        print 'C'
    elif m + f >= 30:
        if r >= 50:
            print 'C'
        else:
            print 'D'
    else:
        print 'F'

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, raw_input().split())

    if (m+f+r) == -3:
        break

    if (m * f) < 0:
        print "F"
    elif (m + f) >= 80:
        print 'A'
    elif 65 <= (m + f) < 80:
        print 'B'
    elif 50 <= (m + f) < 65:
        print 'C'
    elif 30 <= (m + f) < 50:
        if r < 50:
            print 'D'
        else:
            print 'C'
    elif (m + f) < 30:
        print 'F'

Submission status: Accepted

Solution code:
mf = 0
while True:
    m,f,r = [int(i) for i in input().strip().split()]
    if m==f==r==-1 : break
    mf = m+f
 
    if m*f<0 or mf<30 : print("F")
    elif mf<50 and r<50 : print("D")
    elif mf<65 : print("C")
    elif mf<80 : print("B")
    elif mf>=80 : print("A")
    else: print("F")

Submission status: Accepted

Solution code:
import sys

for i in sys.stdin:
    scores = list(map(int, i.split()))
    m = scores[0]
    f = scores[1]
    r = scores[2]
    if m == f == r == -1:
        break
    elif (m == -1) or (f == -1):
        print("F")
    elif m + f >= 80:
        print("A")
    elif 65 <= (m + f) < 80:
        print("B")
    elif 50 <= (m + f) < 65:
        print("C")
    elif 30 <= (m + f) < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Submission status: Accepted

Solution code:
while True :
	m,f,r=map(int,raw_input().split())
	if m==-1 and f==-1 and r==-1:
		break
	else:
		if m==-1 or f==-1 :
			print 'F'
		elif m+f >= 80:
				print 'A'
		elif m+f >= 65:
			print 'B'
		elif m+f >= 50 or r>=50:
			print 'C'
		elif m+f >= 30:
			print 'D'
		else :
			print'F'

Submission status: Accepted

Solution code:
L=[]
c=0
while 1:
  L+=[map(int, raw_input().split())]
  if L[c][0]+L[c][1]+L[c][2]==-3:
    break
  c+=1
  
c=0
while 1:
  if L[c][0]+L[c][1]+L[c][2]==-3:
    break
  if L[c][0]==-1 or L[c][1]==-1 or L[c][0] + L[c][1] < 30:
    print 'F'
  elif L[c][0] + L[c][1] >=80:
    print 'A'
  elif 65 <= L[c][0] + L[c][1] < 80:
    print 'B'
  elif 50 <= L[c][0] + L[c][1] < 65 or 30 <= L[c][0] + L[c][1] < 50 and L[c][2] >= 50:
    print 'C'
  else:
    print 'D'
  c+=1

Submission status: Accepted

Solution code:
while True:
    m,f,r = map(int,raw_input().split())
    if m==-1 and f==-1 and r==-1:
        break 
    mfsum = m+f
    if m==-1 or f==-1:
        print "F"
    elif mfsum >=80:
        print "A"
    elif mfsum >= 65 and mfsum <80:
        print "B"
    elif mfsum >= 50 and mfsum < 65:
        print "C"
    elif mfsum >=30 and mfsum < 50:
        if r >= 50:
            print "C"
        else: 
            print "D"
    else:
        print "F"

Submission status: Accepted

Solution code:
def code():
	l = []
	while True:
		m,f,r = map(int,input().split())
		if m == f == r == -1:
			break
		else:
			l.append([m,f,r])
	for i in l:
		s = ''
		x = i[0]+i[1]
		if i[0] == -1 or i[1] == -1:
			s = 'F'
		elif x >= 80:
			s = 'A'
		elif x >= 65:
			s = 'B'
		elif x >= 50:
			s = 'C'
		elif x >= 30:
			s = 'D'
			if i[2] >= 50:
				s = 'C'
		else:
			s = 'F'
		print(s)
code()

Submission status: Accepted

Solution code:
data = []
while True:
    in_line = raw_input().split()
    m = int(in_line[0])
    f = int(in_line[1])
    r = int(in_line[2])
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        data.append("F")
    elif m + f >= 80:
        data.append("A")
    elif m + f >= 65:
        data.append("B")
    elif m + f >= 50:
        data.append("C")
    elif m + f >= 30:
        if r >= 50:
            data.append("C")
        else:
            data.append("D")
    else:
        data.append("F")
for n in data:
    print n

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        print('F')
        continue
    s = m + f
    if s >= 80:
        print('A')
    elif s >= 65:
        print('B')
    elif s >= 50:
        print('C')
    elif s >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, raw_input().split(" "))
    if m==f==r==-1:
        break
    if m==-1 or f==-1:
        print("F")
    elif m+f >= 80:
        print("A")
    elif 65 <= m+f < 80:
        print("B")
    elif 50 <= m+f < 65:
        print("C")
    elif 30 <= m+f < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    elif m+f < 30:
        print("F")

Submission status: Accepted

Solution code:
while True:
    m,f,r=map(int,input().split())
    p=m+f
    if m+f+r==-3:
        break
    if m==-1 or f==-1:
        print("F")
    elif p>=80:
        print("A")
    elif 65<=p and p<80:
        print("B")
    elif 50<=p and p<65:
        print("C")
    elif 30<=p and p<50:
        if r>=50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Submission status: Accepted

Solution code:
# coding: utf-8

scores = []
grades = []
while (1):
    one = list(map(int, input().split()))
    if sum(one) <= -3:
        break
    scores.append(one)

for s in scores:
    # ??????????¨??????????????¨????????????????????¬???? -> F
    if (s[0] == -1 or s[1] == -1):
        grades.append('F')
        continue
    # ??????????¨???¨??????????¨????????¨??????°???80?????\??? -> A
    if (s[0] + s[1] >= 80):
        grades.append('A')
        continue
    # ??????????¨???¨??????????¨????????¨??????°???65?????\???80????????? -> B
    if (s[0] + s[1] >= 65):
        grades.append('B')
        continue
    # ??????????¨???¨??????????¨????????¨??????°???50?????\???65????????? -> C
    if (s[0] + s[1] >= 50):
        grades.append('C')
        continue
    # ??????????¨???¨??????????¨????????¨??????°???30?????\???50?????????
    if (s[0] + s[1] >= 30):
        if (s[2] >= 50):
            grades.append('C')
            continue
        else:
            grades.append('D')
            continue
    grades.append('F')

for g in grades:
    print(g)

Submission status: Accepted

Solution code:
while True:
    i = input().split()
    m, f, r = map(int, i)

    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        print('F')
    elif m+f >= 80:
        print('A')
    elif m+f < 80 and m+f >= 65:
        print('B')
    elif m+f < 65 and m+f >= 50:
        print('C')
    elif m+f < 50 and m+f >=30:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')

Submission status: Accepted

Solution code:
while True:
    m, f, v = [int(n) for n in input().split()]

    if m == f == v == -1:
        break
    sum = m + f
    if m == -1 or f == -1:
        print("F")
    elif 80 <= sum:
        print("A")
    elif 65 <= sum < 80:
        print("B")
    elif 50 <= sum < 65:
        print("C")
    elif 30 <= sum < 50:
        if 50 <= v:
            print("C")
        else:
            print("D")
    else:
        print("F")

Submission status: Accepted

Solution code:
i = 0
while True:
	m,f,r = list(map(int, input().split()))
	if (m == -1 and f == -1 and r == -1):
		break
	elif ((m == -1) or (f == -1)) or (m + f < 30):
		print("F")
	elif (80 <= m + f):
		print("A")
	elif (65 <= m + f) and (m + f < 80):
		print("B")
	elif (50 <= m + f) and (m + f < 65) or (50 <= r):
		print("C")
	elif (30 <= m + f) and (m + f <50) :
		print("D")

Submission status: Accepted

Solution code:
while True:
	m,f,r = list(map(int, input().split()))
	if (m == -1 and f == -1 and r == -1):
		break
	elif ((m == -1) or (f == -1)) or (m + f < 30):
		print("F")
	elif (80 <= m + f):
		print("A")
	elif (65 <= m + f) and (m + f < 80):
		print("B")
	elif (50 <= m + f) and (m + f < 65) or (50 <= r):
		print("C")
	elif (30 <= m + f) and (m + f <50) :
		print("D")

Submission status: Accepted

Solution code:
def grade(m, f, r):
    if m == -1 or f == -1:
        return 'F'
    s = m + f
    if s >= 80:
        return 'A'
    elif s >= 65:
        return 'B'
    elif s >= 50:
        return 'C'
    elif s < 30:
        return 'F'
    elif r >= 50:
        return 'C'
    else:
        return 'D'


while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    print(grade(m, f, r))

Submission status: Accepted

Solution code:
num = []
while True:
    m,f,r = map(int, raw_input().split())

    ans = m + f
    if m == f == r == -1:
        break
    if (m == -1) or (f == -1):
        num.append("F")
    elif ans >= 80:
        num.append("A")
    elif (65 <= ans) and (ans < 80):
        num.append("B")
    elif (50 <= ans) and (ans < 65):
        num.append("C")
    elif (30 <= ans) and (ans < 50):
        if r >= 50:
            num.append("C")
        else:
            num.append("D")
    else:
        num.append("F")

for i in range(len(num)):
    print num[i]

Submission status: Accepted

Solution code:
num = []
while True:
    l = map(int, raw_input().split())
    if l[0] == l[1] == l[2] == -1:
        break
    if l[0]*l[1] < 0:
        num.append("F")
    else:
        sum = l[0] + l[1]
        if sum >= 80:
            num.append("A")
        elif sum >= 65:
            num.append("B")
        elif sum >= 50:
            num.append("C")
        elif sum >= 30:
            if l[2] >= 50:
                num.append("C")
            else:
                num.append("D")
        else:
            num.append("F")

for i in range(len(num)):
    print num[i]

Submission status: Accepted

Solution code:
import sys

a = sys.stdin.readlines()
for i in range(len(a)):
	b = a[i].split()
	m =int(b[0])
	f =int(b[1])
	r =int(b[2])
	if m*f < 0 :
		print "F"
	elif m==-1 and f==-1 and r==-1:
		break
	else:
		if m+f >= 80:
			print "A"
		elif 80 > m+f >=65:
			print "B"
		elif 65 > m+f >=50:
			print "C"
		elif 50 > m+f >=30 and r < 50:
			print "D"
		elif 50 > m+f >=30 and r >= 50:	
			print "C"
		elif 30 > m+f:
			print "F"

Submission status: Accepted

Solution code:
A=[]
while True:
	#midterm exam score(50) : m
	#final  exam score(50)  : f
	#retest score(100)      : r
	m,f,r = [int(i) for i in input().split()]
	if m == f == r == -1:
		break
	elif m==-1 or f==-1:
		A.append('F')	
	elif m+f >= 80:
		A.append('A')
	elif 65<=m+f<80:
		A.append('B')
	elif (50<=m+f<65) or ((30<=m+f<50) and (50<=r)):
		A.append('C')
	elif (30<=m+f<50):
		A.append('D')
	else:
		A.append('F')

for i in range(len(A)):
	print(A[i])

Submission status: Accepted

Solution code:
A=[]
while True:
	#midterm exam score(50) : m
	#final  exam score(50)  : f
	#retest score(100)      : r
	m,f,r = [int(i) for i in input().split()]
	if m == f == r == -1:
		break
	elif m==-1 or f==-1:
		A.append('F')	
	elif m+f >= 80:
		A.append('A')
	elif 65<=m+f<80:
		A.append('B')
	elif (50<=m+f<65) or ((30<=m+f<50) and (50<=r)):
		A.append('C')
	elif (30<=m+f<50):
		A.append('D')
	else:
		A.append('F')

for i in A:
	print(i)

Submission status: Accepted

Solution code:
while True:
    try:
        m,f,r = map(int,input().split(" "))
        if m == -1:
            if f == -1:
                if r == -1:
                    break
        if m == -1 or f == -1:
            print("F")
            continue
        if m+f >= 80:
            print("A")
        if m+f >= 65 and m+f < 80:
            print("B")
        if m+f >= 50 and m+f < 65:
            print("C")
        if m+f >= 30 and m+f < 50:
            if r >= 50:
                print("C")
            else:
                print("D")
        if m+f < 30:
            print("F")
    except EOFError:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        m,f,r = map(int,input().split(" "))
        if m == -1 and f == -1 and r == -1:
            break
        if m == -1 or f == -1:
            print("F")
            continue
        if m+f >= 80:
            print("A")
        if m+f >= 65 and m+f < 80:
            print("B")
        if m+f >= 50 and m+f < 65:
            print("C")
        if m+f >= 30 and m+f < 50:
            if r >= 50:
                print("C")
            else:
                print("D")
        if m+f < 30:
            print("F")
    except EOFError:
        break

Submission status: Accepted

Solution code:
for m, f, r in ((int(j) for j in i.split()) for i in iter(input, "-1 -1 -1")):
  if m == -1 or f == -1:
    print ('F')
  elif m + f >= 80:
    print ('A')
  elif m + f >= 65:
    print ('B')
  elif m + f >= 50 or (m + f >= 30 and r >= 50):
    print ('C')
  elif m + f >= 30:
    print ('D')
  else:
    print ('F')

Submission status: Accepted

Solution code:
student_info = []
while True:
    s = map(int,raw_input().split(" "))

    if s[0] is s[1] is s[2] is -1:
        break
    
    student_info.append(s)

score_info = []
for s in student_info:
    if s[0] == -1 or s[1] == -1:
        score_info.append("F")

    elif s[0]+s[1] >= 80:
        score_info.append("A")

    elif 65 <= s[0]+s[1] < 80:
        score_info.append("B")

    elif 50 <= s[0]+s[1] < 65:
        score_info.append("C")

    elif 30<= s[0]+s[1] < 50:
        if s[2] >= 50:
            score_info.append("C")
        else:
            score_info.append("D")
    else:
        score_info.append("F")

for i in score_info:
    print i

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

while True:
    m, f, r = map(int, raw_input().split())
    if m == f == r == -1:
        break
    elif m == -1 or f == -1:
        print 'F'
    elif m+f >= 80:
        print 'A'
    elif m+f >= 65:
        print 'B'
    elif m+f >= 50:
        print 'C'
    elif m+f >= 30:
        if r >= 50:
            print 'C'
        else:
            print 'D'
    else:
        print 'F'

Submission status: Accepted

Solution code:
while True:
    mid, term, add = map(int, input().split())
    if mid == -1 and term == -1 and add == -1:
        break
    if mid == -1 or term == -1:
        rank = 'F'
    elif mid + term >= 80:
        rank = 'A'
    elif mid + term >= 65:
        rank = 'B'
    elif mid + term >= 50:
        rank = 'C'
    elif mid + term >= 30:
        if add >= 50:
            rank = 'C'
        else:
            rank = 'D'
    else:
        rank = 'F'
    print(rank)

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, raw_input().split())
    if m==-1 and f==-1 and r==-1:
        break
    elif m==-1 or f==-1:
        print 'F'
    elif m+f>=80:
        print 'A'
    elif 65<=m+f<80:
        print 'B'
    elif 50<=m+f<65:
        print 'C'
    elif 30<=m+f<50:
        if r>=50:
            print 'C'
        else:
            print 'D'
    elif 0<=m+f<30:
        print 'F'

Submission status: Accepted

Solution code:

x = raw_input()
m, f, r = x.split()
m = int(m)
f = int(f)
r = int(r)

while m != -1 or f != -1 or r != -1:
    sum = m + f
    if (m == -1 or f == -1) or sum < 30:
        print "F"
    elif sum >= 80:
        print "A"
    elif 80 > sum and sum >= 65:
        print "B"
    elif 65 > sum and sum >= 50:
        print "C"
    elif 50 > sum and sum >= 30:
        if r < 50:
            print "D"
        else:
            print "C"
            
    x = raw_input()
    m, f, r = x.split()
    m = int(m)
    f = int(f)
    r = int(r)

Submission status: Accepted

Solution code:
while True:
    inter_test,end_test,re_test = map(int,raw_input().split())

    if [inter_test,end_test,re_test] == [-1,-1,-1]:
        break
    if inter_test == -1 or end_test == -1 :
        print 'F'
    elif inter_test+end_test >= 80 :
        print 'A'
    elif inter_test+end_test >= 65 :
        print 'B'
    elif inter_test+end_test >= 50 :
        print 'C'
    elif inter_test+end_test >= 30 :
        if re_test >= 50 :
            print 'C'
        else :
            print 'D'
    else :
        print 'F'

Submission status: Accepted

Solution code:
while True:
    i,e,r = map(int,raw_input().split())

    if i == e == r == -1:
        break
    if i == -1 or e == -1 :
        print 'F'
    elif i+e >= 80 :
        print 'A'
    elif i+e >= 65 :
        print 'B'
    elif i+e >= 50 :
        print 'C'
    elif i+e >= 30 :
        if r >= 50 :
            print 'C'
        else :
            print 'D'
    else :
        print 'F'

Submission status: Accepted

Solution code:
while(True):
    m, f, r = map(int, input().split())
    if(m == f == r == -1): break
    score = m + f

    if(m==-1 or f==-1): print('F')
    elif(score >= 80): print('A')
    elif(score >= 65): print('B')
    elif(score >= 50): print('C')
    elif(score >= 30):
        if(r >= 50): print('C')
        else: print('D')
    else: print('F')

Submission status: Accepted

Solution code:
m, f, r = map(int, raw_input().split())

while m != -1 or f != -1 or r != -1:

	s = m + f

	if m == -1 or f == -1:
		print "F"
	elif s >= 80:
		print "A"
	elif s >= 65:
		print "B"
	elif s >= 50:
		print "C"
	elif s >=30:
		if r >= 50:
			print "C"
		else:
			print "D"
	else:
		print "F"

	m, f, r = map(int, raw_input().split())

Submission status: Accepted

Solution code:


n = 0
while n == 0:
    m = map(int,raw_input().split())
    if m[0] + m[1] + m[2] == -3:
        break
    if m[0] == -1 or m[1] == -1:
        print "F"
    else:
        for i in xrange(2):
            if m[i] == -1:
                m[i] = 0
        k = m[0] + m[1]
        if k >= 80:
            print "A"
        elif k >= 65:
            print "B"
        elif k >= 50:
            print "C"
        elif k >= 30:
            if m[2] >= 50:
                print "C"
            else:
                print "D"
        elif k < 30:
            print "F"

Submission status: Accepted

Solution code:
while 1:
    m,f,r=map(int,input().split())
    if m == -1 and f == -1 and r == -1: break
    if m == -1 or f == -1: s = 'F'
    elif m + f >= 80: s = 'A'
    elif m + f >= 65: s = 'B'
    elif m + f >= 50: s = 'C'
    elif m + f >= 30: 
        if r >= 50: s = 'C'
        else : s = 'D'
    else : s = 'F'
    print(s)

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, input().split())
    A = m + f
    if m == f == r == -1:
        break
    elif m == -1 or f == -1:
        print('F')
    elif A >= 80:
        print('A')
    elif 65 <= A < 80:
        print('B')
    elif 50 <= A < 65:
        print('C')
    elif 30 <= A < 50:
        if 50 <= r:
            print('C')
        else:
            print('D')
    else:
        print('F')

Submission status: Accepted

Solution code:
while True:
    m,f,r = [int(x) for x in input().split()]
    if (m,f,r)==(-1,-1,-1): break
    s_mf = m + f
    if   m < 0 or f < 0: mark = 'F'
    elif s_mf <  30:     mark = 'F'
    elif s_mf >= 80:     mark = 'A'
    elif s_mf >= 65:     mark = 'B'
    elif s_mf >= 50:     mark = 'C'
    elif r    >= 50:     mark = 'C'
    else:                mark = 'D'
    print(mark)

Submission status: Accepted

Solution code:
while True:
    m,f,r = [int(x) for x in input().split()]
    if (m,f,r)==(-1,-1,-1): break
    s_mf = m + f
    if   m < 0 or f < 0: print('F')
    elif s_mf <  30:     print('F')
    elif s_mf >= 80:     print('A')
    elif s_mf >= 65:     print('B')
    elif s_mf >= 50:     print('C')
    elif r    >= 50:     print('C')
    else:                print('D')

Submission status: Accepted

Solution code:
while 1:
	m,f,r=map(int,raw_input().split())
	if (m==-1 and f==-1 and r==-1):
		break
	elif (m+f>=80):
		print "A"
	elif (m+f>=65 and m+f<80):
		print "B"
	elif (m+f>=50 and m+f<65 or r>=50):
		print "C"
	elif (m+f>=30 and m+f<50 and r<50 and m!=-1 and f!=-1):
		print "D"
	elif (m+f<30 or m==-1 or f==-1):
		print "F"

Submission status: Accepted

Solution code:
import sys
import math

while 1:
    m, f, r = map(int, raw_input().split())

    if m + f + r == -3 :
        break

    if m == -1 or f == -1 :
        print "F"
    elif m + f >= 80 :
        print "A"
    elif m + f >= 65 :
        print "B"
    elif m + f >= 50 :
        print "C"
    elif m + f >= 30 :
        if r >= 50 :
            print "C"
        else :
            print "D"
    else :
        print "F"

Submission status: Accepted

Solution code:
while True:
	pt=map(int,raw_input().split(" "))
	if pt[0]==-1 and pt[1]==-1 and pt[2]==-1:
		break
	elif pt[0]==-1 or pt[1]==-1:
		print "F"
	elif pt[0]+pt[1]>=80:
		print "A"
	elif 65<=pt[0]+pt[1]<80:
		print "B"
	elif 50<=pt[0]+pt[1]<65:
		print "C"
	elif 30<=pt[0]+pt[1]<50 and pt[2]<50:
		print "D"
	elif 30<=pt[0]+pt[1]<50 and pt[2]>=50:
		print "C"
	elif pt[0]+pt[1]<30:
		print "F"

Submission status: Accepted

Solution code:
while(True):
	score = [int(i) for i in input().split()]
	if score[:] == [-1,-1,-1]:
		break
	if score[0] == -1 or score[1] == -1:
		print('F')
	else:
		score_sum = score[0] + score[1]
		if score_sum >= 80:
			print('A')
		elif 80 > score_sum >= 65:
			print('B')
		elif 65 > score_sum >= 50:
			print('C')
		elif 50 > score_sum >= 30:
			if score[2] >= 50:
				print('C')
			else :
				print('D')
		elif 30 > score_sum:
			print('F')

Submission status: Accepted

Solution code:
while True:
    data = input().split()
    m = int(data[0])
    f = int(data[1])
    r = int(data[2])
    if m == -1 and f == -1 and r == -1:
        break
    elif m == -1 or f == -1:
        print('F')
    else:
        if m + f >= 80:
            print('A')
        elif m + f >= 65:
            print('B')
        elif m + f >= 50:
            print('C')
        elif m + f >= 30:
            if r >= 50:
                print('C')
            else:
                print('D')
        else:
            print('F')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
while True:
    m,f,r = [int(i) for i in input().split(' ')]
    if m == -1 and f == -1 and r == -1:
        break
    else:
        if m == -1 or f == -1 or m + f < 30:
            print("F")
        elif m + f >= 80:
            print("A")
        elif m + f >= 65 and m + f <80:
            print("B")
        elif m + f >= 50 and m + f < 65:
            print("C")
        elif m + f >= 30 and m + f < 50:
            if r>=50:
                print("C")
            else:
                print("D")

Submission status: Accepted

Solution code:
while True:
    m,f,r = map(int, input().split())
    if m == -1 and  f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50:
        print("C")
    elif m + f >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Submission status: Accepted

Solution code:

if __name__ == "__main__":
	while True:
		score = [int(i) for i in input().split()]
		if score[0] == score[1] == score[2] == -1:
			break
		if score[0] == -1 or score[1] == -1:
			print ('F')
		else:
			if score[0] + score[1] >= 80:
				print ('A')
			elif score[0] + score[1] >= 65:
				print ('B')
			elif score[0] + score[1] >= 50:
				print ('C')
			elif score[0] + score[1] >= 30:
				if score[2] == -1:
					print ('D')
				else:
					if score[2] >= 50:
						print ('C')
					else:
						print ('D')
			else:
				print ('F')

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, input().split())
    total = m + f
    if m == f == r == -1:
        break
    elif m == -1 or f == -1:
        print("F")
    elif 80 <= total:
        print("A")
    elif 65 <= total:
        print("B")
    elif 50 <= total:
        print("C")
    elif 30 <= total:
        if 50 <= r:
            print("C")
            continue
        print("D")
    else:
        print("F")

Submission status: Accepted

Solution code:
while (True):
    code=list(map(int,input().split()))
    if(code[0]==-1 and code[1]==-1 and code[2]==-1):
        break
    sum=code[0]+code[1]    
    if(code[0]==-1 or code[1]==-1):
        print("F")
    elif(sum>=80):
        print("A")
    elif(sum>=65):
        print("B")
    elif(sum>=50):
        print("C")
    elif(sum<30):
        print("F")
    elif(sum>=30 and code[2]>=50):
        print("C")
    else:
        print("D")

Submission status: Accepted

Solution code:
while True:

    m, f, r = map(int, input().split())
    if m==f==r== -1:
        break
    result = ""
    sum = m + f
    
    if (m==-1)or(f==-1):
        result = "F"
    elif sum >= 80:
        result = 'A'
    elif sum>= 65:
        result = "B"
    elif sum>=50:
        result = "C"
    elif sum>= 30:
        result="D"
        if r>=50:
            result = 'C'
    else:
        result = 'F'

    print("{}".format(result))

Submission status: Accepted

Solution code:
while True:
	m, f, r = map(int, input().split())

	if (m == -1 and f == -1 and r == -1):
		break

	if (m == - 1 or f == -1):
		print('F')
	elif (m + f >= 80):
		print('A')
	elif (65 <= m + f < 80):
		print('B')
	elif (50 <= m + f < 65):
		print('C')
	elif (30 <= m + f < 50):
		if (r >= 50):
			print('C')
		else:
			print('D')
	else:
		print('F')

Submission status: Accepted

Solution code:
while True:
    m,f,r = map(int,input().split())
    if m == f == r == -1 :
        break
    elif m == -1 or f == -1 :
        print("F")
    elif m + f >= 80 :
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50 :
        print("C")
    elif m + f >= 30 :
        if r >= 50:
            print("C")
        else :
            print("D")
    else :
        print("F")

Submission status: Accepted

Solution code:
while True:
	m, f, r = map(int, input().split())
	if m == f == r == -1: break
	if m == -1 or f == -1: print("F")
	elif m + f >= 80: print("A")
	elif m + f >= 65: print("B")
	elif m + f >= 50: print("C")
	elif m + f >= 30:
		if r >= 50: print("C")
		else: print("D")
	else: print("F")

Submission status: Accepted

Solution code:
result = []
m,f,r=[int(x) for x in input().split()]
while not m==f==r==-1:
    if (m == -1 or f == -1):
        res = "F"
    elif (m + f >= 80):
        res = "A"
    elif (65 <= m + f < 80):
        res = "B"
    elif (50 <= m + f < 65):
        res = "C"
    elif (30 <= m + f < 50):
        res = "D"
        if (50 <= r):
            res = "C"
    else :
        res = "F"
    result.append(res)
    m,f,r=[int(x) for x in input().split()]
for i in result:
    print(i)

Submission status: Accepted

Solution code:
def judgetest(a, b, c):
    if a == -1 or b == -1:
        return 'F'
    sum = a + b
    if sum >= 80:
        return 'A'
    elif sum >= 65:
        return 'B'
    elif sum >= 50:
        return 'C'
    elif sum >= 30:
        if c >= 50:
            return 'C'
        else:
            return 'D'
    else:
        return 'F'

list = []
while True:
    a, b, c = map(int, input().split())
    if a == b == c == -1:
        break
    list.append(judgetest(a, b, c))

for s in list:
    print(s)