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 result(_m, _f, _r):
    if _m==-1 or _f==-1: return "F"
    elif _m+_f>=80: return "A"
    elif _m+_f>=65: return "B"
    elif _m+_f>=50: return "C"
    elif _m+_f>=30 and _r>=50: return "C"
    elif _m+_f>=30: return "D"
    else: return "F"

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

Submission status: Accepted

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

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:
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:
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -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 or r >= 50:
        print("C")
    elif 30 <= (m+f) < 50:
        print("D")
    elif m+f < 30:
        print("F")

Submission status: Accepted

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


main()

Submission status: Accepted

Solution code:
# coding: utf-8
while True:
    line = input().split()
    m = int(line[0])
    f = int(line[1])
    r = int(line[2])
    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:
    c, k, s = map(int, input().split())
    if c+k+s > -3:
        if -1 in [c, k]:
            print('F')
        elif c+k >= 80:
            print('A')
        elif c+k >= 65:
            print('B')
        elif c+k >= 50:
            print('C')
        elif c+k >= 30:
            if s >= 50:
                print('C')
            else:
                print('D')
        else:
            print('F')
    else:
        break

Submission status: Accepted

Solution code:
while True:
    m,f,r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    if -1 in (m, f): 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:
while True:
    m, f, r = map(int, input().split())
    if m == f == r== -1:
        break
    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")

Submission status: Accepted

Solution code:
mid = 0
end = 0
re = 0

while(1):
    mid, end, re = map(int, input().split() )
    if (mid == -1) and (end == -1) and (re == -1) :
        break

    if (mid == -1) or (end == -1):
        print("F")
    elif mid + end >= 80:
        print("A")
    elif mid + end >= 65:
        print("B")
    elif mid + end >= 50:
        print("C")
    elif mid + end >= 30:
        if re >= 50:
            print("C")
        else: print("D")
    else: print("F")

Submission status: Accepted

Solution code:
while True:
        list = input().split()
        m = int(list[0])
        f = int(list[1])
        r = int(list[2])
        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 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 == -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("D")
        else:
            print("C")
    else:
        print("F")

Submission status: Accepted

Solution code:
while True:
    grade = input()
    grade_list = grade.split(" ")
    mid_exam = int(grade_list[0])
    fin_exam = int(grade_list[1])
    re_exam = int(grade_list[2])
    if mid_exam == -1 and fin_exam == -1 and re_exam == -1:
        break
    if mid_exam == -1 or  fin_exam == -1:
        print("F")
    elif mid_exam + fin_exam >= 80:
        print("A")
    elif mid_exam + fin_exam >= 65:
        print("B")
    elif mid_exam + fin_exam >= 50:
        print("C")
    elif mid_exam + fin_exam >= 30 and re_exam >= 50:
        print("C")
    elif mid_exam + fin_exam >= 30:
        print("D")
    else:
        print("F")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m, f, r = map(int, input().split())
while m >= 0 or f >= 0 or r >= 0:
	if m < 0 or f < 0 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:
		if r >= 50:
			print("C")
		else:
			print("D")
	m, f, r = map(int, input().split())

Submission status: Accepted

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

Submission status: Accepted

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

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:
while 1:
 m,f,r=map(int,input().split())
 if m==f==r==-1:break
 s=m+f;print(("ABCDF")[(s<80)+(s<65)+(s<50>r)+((m<0)+(f<0)+(s<30))])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while 1:
    a,b,c=map(int, input().split())
    if a*b*c==-1 and a<0:break
    if a<0 or b<0:print('F')
    elif a+b>=80:print('A')
    elif a+b>=65:print('B')
    elif a+b>=50:print('C')
    elif a+b>=30:
        if c>=50:print('C')
        else:print('D')
    else:print('F')

Submission status: Accepted

Solution code:
table = [[0]*3 for i in range(50)]

times = 0 
for i in range(50):
    
    score = input().split()
    
    if  score[0] == "-1" and score[1] == "-1" and score[2] == "-1":
        break
        
    for j in range(3):
         table[i][j] = int(score[j])
    
    times += 1

for a in range(times):
    
    total_score = table[a][0] + table[a][1]
    
    if table[a][0] == -1 or table[a][1] == -1:
        print("F")
    
    elif total_score >= 80:
        print("A")

    elif total_score >= 65:
        print("B")

    elif total_score >= 50:
        print("C")

    elif total_score >= 30:
        if table[a][2] >= 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 : ans = "F"
    elif (m+f >= 80) : ans = "A"
    elif (m+f >= 65) : ans = "B"
    elif (m+f >= 50) : ans = "C"
    elif (m+f >= 30) :
        if (r >= 50) : ans = "C"
        else : ans = "D"
    else : ans = "F"
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# coding: Shift_JIS
# coding: EUC-JP
# coding: cp932
import math

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

Submission status: Accepted

Solution code:
import sys


def evaluate(m, f, r):
    if m == -1 or f == -1:
        return 'F'

    total = m + f

    if total >= 80:
        return 'A'
    if total >= 65:
        return 'B'
    if total >= 50:
        return 'C'
    if total >= 30:
        return 'C' if r >= 50 else 'D'
    return 'F'


for line in sys.stdin:
    m, f, r = map(int, line.strip().split())
    if m == f == r == -1:
        break
    print(evaluate(m, f, r))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
data = []

while 1:
    data.append(list(map(int, input().split())))
    if data[-1] == [-1,-1,-1]:
        data.pop(-1)
        break

for i in range(len(data)):
    TOTAL = data[i][0] + data[i][1]

    if data[i][0] * data[i][1] < 0:
        print('F')
        continue
    elif TOTAL >= 80:
        print('A')
        continue
    elif TOTAL >= 65:
        print('B')
        continue
    elif TOTAL >= 50:
        print('C')
        continue
    elif TOTAL >= 30:
        if data[i][2] >= 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 or m+f<30:
        jdg='F'
    elif m+f>=80:
        jdg="A"
    elif m+f>=65:
        jdg="B"
    elif m+f>=50:
        jdg="C"
    else:
        jdg="C" if r>=50 else "D"
    print(jdg)

Submission status: Accepted

Solution code:
import bisect

def rank(m, f, r):
    if m == -1 or f == -1:
        return 'F'
    sum = m + f
    if 30 <= sum < 50 and r >= 50:
        return 'C'
    return 'FDCBA'[bisect.bisect([30,50,65,80],sum)]

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

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, 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 (m + f) < 30:
        print('F')

Submission status: Accepted

Solution code:
def main():
	while True:
		m, f, r = (int(x) for x in 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 50 <= r:
				print('C')
			else:
				print('D')
		else:
			print('F')

main()

Submission status: Accepted

Solution code:
soten_set=[]
soten=list(map(int,input().split()))

while soten[0]!=-1 or soten[1]!=-1 or soten[2]!=-1:
    soten_set.append(soten)
    soten=list(map(int,input().split()))

for i in range(len(soten_set)):
    m=soten_set[i][0]
    f=soten_set[i][1]
    r=soten_set[i][2]

    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")
    elif m+f<30:
        print("F")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

score = []
while True:
  m, f, r = map(int, input().split())
  if (m == -1 and f == -1 and r == -1):
    break
  else:
    score.append([m, f, r])

for i in range(len(score)):
  if (score[i][0] == -1 or score[i][1] == -1):
      print("F")
  elif (score[i][0]+score[i][1] >= 80):
    print("A")
  elif (score[i][0]+score[i][1] >= 65):
    print("B")
  elif (score[i][0]+score[i][1] >= 50 or (score[i][0]+score[i][1] >= 30 and score[i][2] >= 50)):
    print("C")
  elif (score[i][0]+score[i][1] >= 30):
    print("D")
  else:
    print("F")

Submission status: Accepted

Solution code:

while True:
    (a,b,c)  =  map(int,input().split())
    if ( a == b == c == -1 ):
        break
    if ( a == -1 or b == -1):
        print ("F")
        continue
    if ( a + b >= 80):
        print ("A")
        continue
    elif(a + b >= 65 ):
        print ("B")
        continue
    elif(a + b >= 50 ):
        print ("C")
        continue
    elif(a + b >= 30 ):
        if ( c >= 50):
            print ("C")
        else:
            print ("D")
        continue
    print("F")

Submission status: Accepted

Solution code:
import sys
for i in range(sys.maxsize):
    m,f,r=map(int,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 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:
score = ["e" for i in range(50)]
counter = 0
for i in range(50):
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    counter += 1
    if m == -1 or f == -1:
        score[i] = "F"
    elif m + f >= 80:
        score[i] = "A"
    elif m + f >= 65:
        score[i] = "B"
    elif m + f >= 50:
        score[i] = "C"
    elif m + f >= 30:
        if r >= 50:
            score[i] ="C"
        else:
            score[i] = "D"
    else:
        score[i] = "F"
for i in range(counter):
    print (score[i])

Submission status: Accepted

Solution code:
mlist = []
flist = []
rlist = []

while(1):
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    mlist.append(m)
    flist.append(f)
    rlist.append(r)

for m, f, r in zip(mlist, flist, rlist):
    if m == -1 or f == -1:
        print("F")
    elif 80 <= m + f:
        print("A")
    elif 65 <= m + f < 80:
        print("B")
    elif 50 <= m + f < 65:
        print("C")
    elif 30 <= m + f < 50:
        if 50 <= r:
            print("C")
        else:
            print("D")
    else:
        print("F")

Submission status: Accepted

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

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 or m + f < 30:
		print("F")
	elif m + f >= 80:
		print("A")
	elif 65 <= m + f:
		print("B")
	elif 50 <= m + f:
		print("C")
	else:
		if r >= 50:
			print("C")
		else:
			print("D")

Submission status: Accepted

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


while True:
    m,f,r = map(int,input().split())
    ans = calculate_grade(m,f,r)
    if ans:
        print(ans)
    else:
        break

Submission status: Accepted

Solution code:
while True:
    temp = input()
    m, f, r = temp.split(' ')
    m, f, r = int(m), int(f), int(r)
    
    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:
score = []
while True:
    (m,f,r)=map(int, input().split())
    if (m,f,r)==(-1,-1,-1):
        break
    score.append([m, f, r])
    
for i in range(len(score)):
    m=score[i][0]
    f=score[i][1]
    r=score[i][2]
    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"
    print(grade)

Submission status: Accepted

Solution code:
while(1):
    m,f,r=map(int,input().split())
    if(m==f==r==-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 <= r):
            print("C")
        else:
            print("D")
    else:
        print("F")

Submission status: Accepted

Solution code:
while True:
    m_test_point, f_test_point, r_test_point = map(int, input().split())
    if m_test_point == f_test_point == r_test_point == -1:
        break
    m_f_total = m_test_point + f_test_point
    if m_test_point == -1 or f_test_point == -1 or m_f_total < 30:
        print("F")
    elif m_f_total >= 80:
        print("A")
    elif 65 <= m_f_total < 80:
        print("B")
    elif 50 <= m_f_total < 65:
        print("C")
    elif 30 <= m_f_total < 50 and r_test_point >= 50:
        print("C")
    elif 30 <= m_f_total < 50:
        print("D")

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

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, input().split())
    if m==f==r==-1:
        break
    if m<0 or f<0:
        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:
	test=list(map(int,input().split()))
	if test[0]==-1 and test[1]==-1 and test[2]==-1:
		break
	elif test[0]==-1 or test[1]==-1:
		print('F')
	elif 80<=test[0]+test[1]:
		print('A')
	elif 65<=test[0]+test[1]<80:
		print('B')
	elif 50<=test[0]+test[1]<65:
		print('C')
	elif 30<=test[0]+test[1]<50:
		if 50<=test[2]:
			print('C')
		else:
			print('D')
	elif test[0]+test[1]<30:
		print('F')

Submission status: Accepted

Solution code:
dataset = []

while True:
    data = list(map(int,input().split()))
    dataset.append(data)
    if data == [-1,-1,-1]:
        break
    
for i in range(len(dataset)-1):
    if dataset[i][0] == -1 or dataset[i][1] == -1:
        print('F')
    else:
        if dataset[i][0]+dataset[i][1] >= 80:
            print('A')
        elif dataset[i][0]+dataset[i][1] >= 65:
            print('B')
        elif dataset[i][0]+dataset[i][1] >= 50:
            print('C')
        elif dataset[i][0]+dataset[i][1] >= 30:
            if dataset[i][2] >= 50:
                print('C')
            else:
                print('D')
        elif dataset[i][0]+dataset[i][1] < 30:
            print('F')

Submission status: Accepted

Solution code:
grades = []
m, f, r = map(int, input().split())

while (m != -1 or f != -1 or r != -1):
    if (m == -1 or f == -1):
        grades.append('F')
    elif (m +f >= 80):
        grades.append('A')
    elif (m +f >= 65 and m +f < 80):
        grades.append('B')
    elif (m +f >= 50 and m +f < 65):
        grades.append('C')
    elif (m +f >= 30 and m +f < 50):
        if (r >= 50):
            grades.append('C')
        else :
            grades.append('D')
    else :
        grades.append('F')
    m, f, r = map(int, input().split())

for i in grades:
    print(i)

Submission status: Accepted

Solution code:
# 各評定のボーダー値を定義
border_a = 80
border_b = 65
border_c = 50
border_d = 30
border_retest = 50

# 特定の入力値(-1, -1, -1)以外の間は繰り返す
while True:
    m,f,r = map(int, input().split())
    mf = m + f

    if (m==-1)and(f==-1)and(r==-1):
        break
    elif (m==-1)or(f==-1):
        print("F")
    elif mf >= border_a:
        print("A")
    elif mf >= border_b:
        print("B")
    elif mf >= border_c:
        print("C")
    elif mf >= border_d:
        if r >= border_retest:
            print("C")
        else:
            print("D")
    else:
        print("F")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

# ITP1_7_A


def judge(point,re_exam_point):
    if point>=80:
        return "A"
    elif 65 <= point < 80:
        return "B"
    elif 50 <= point < 65:
        return "C"
    elif 30 <= point < 50:
        if re_exam_point >= 50:
            return "C"
        return "D"
    else:
        return "F"
        
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")
    else:
        total=m+f
        print(judge(total,r))

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 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:
		if r>=50:
			print("C")
		else:
			print("D")

Submission status: Accepted

Solution code:
gradeList = []
i = 0

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

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

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 80 <= (m + f):
        print("A")
    elif 65 <= (m + f) < 80:
        print("B")
    elif 50 <= (m + f) < 65:
        print("C")
    elif 30 <= (m + f) < 50:
        if 50 <= r:
            print("C")
        else:
            print("D")
    elif (m + f) < 30:
        print("F")