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

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

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

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 = (int(x) for x in input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    sum_score = m + f

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

Submission status: Accepted

Solution code:
def judge(m,f,r):
    ret = 'F'
    score = m + f
    if -1 in (m,f): pass
    elif score >= 80: ret = 'A'
    elif score >= 65: ret = 'B'
    elif score >= 50: ret = 'C'
    elif score >= 30: 
        ret = 'D'
        if r >= 50:ret = 'C'
    return ret     
while True:
    m,f,r=map(int,input().split())
    if m==f==r==-1: break
    print(judge(m,f,r))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in ret:
    print i

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

Submission status: Accepted

Solution code:
# Aizu Problem ITP_1_7_A: Grading
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


while True:
    m, f, r = [int(_) for _ in input().split()]
    score = m + f
    if m == f == r == -1:
        break
    elif m == -1 or f == -1:
        print('F')
    elif score >= 80:
        print('A')
    elif score >= 65:
        print('B')
    elif score >= 50 or (score >= 30 and r >= 50):
        print('C')
    elif score >= 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
    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:
    points = list(map(int,input().split()))

    if points == [-1,-1,-1]:
        break

    gou = points[0] + points[1]
    if points[0]==-1 or points[1]==-1:
        print("F")
    elif gou >= 80:
        print("A")
    elif 65 <= gou < 80:
        print("B")
    elif 50 <= gou < 65:
        print("C")
    elif 30 <= gou < 50:
        if points[2] >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Submission status: Accepted

Solution code:
# ???????????????????????¢??°
def eval(m, f, r):
    if m == -1 or f == -1:
        return "F"
    elif m + f >= 80:
        return "A"
    elif 65 <= m + f < 80:
        return "B"
    elif 50 <= m + f < 65:
        return "C"
    elif 30 <= m + f < 50:
        if r >= 50:
            return "C"
        else:
            return "D"
    elif m + f < 30:
        return "F"


while 1:
    mfr = input().split()
    m = int(mfr[0])
    f = int(mfr[1])
    r = int(mfr[2])

    if m == -1 and f == -1 and r == -1:
        break
    else:
        print(eval(m, f, r))

Submission status: Accepted

Solution code:
while(True):
    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')
    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 and r < 50):
        print('D')
    elif(r >= 50):
        print('C')
    else:
        print('F')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while 1:
    list = [input().split()]
    m = int(list[0][0])
    f = int(list[0][1])
    r = int(list[0][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 65 <= m + f and m + f < 80 :
        print("B")
    elif 50 <= m + f and m + f < 65 :
        print("C")
    elif 30 <= m + f and m + f < 50 and 50 <= r :
        print("C")
    elif 30 <= m + f and m + f < 50 and r < 50 :
        print("D")
    elif m + f < 30 :
        print("F")

Submission status: Accepted

Solution code:
m = 0
f = 0
r = 0

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

Submission status: Accepted

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

while m+f+r != -3:
    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")

    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
    if m + f < 30 or 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 30 <= m + f < 50 and r >= 50:
        print("C")
    else :
        print("D")

Submission status: Accepted

Solution code:
def f(s):
    m, f, r = list(map(int, s.split()))
    if m == -1 or f == -1:
        return "F"

    t = m + f
    if 80 <= t:
        return "A"
    elif 65 <= t:
        return "B"
    elif 50 <= t:
        return "C"
    elif 30 <= t:
        return "C" if 50 <= r else "D"
    else:
        return "F"

while True:
    s = input()
    if s == "-1 -1 -1":
        break
    print(f(s))

Submission status: Accepted

Solution code:
grade=[]

while True:
    test_point=[]
    test_point=input().split()
    test_point[0]=int(test_point[0])
    test_point[1]=int(test_point[1])
    test_point[2]=int(test_point[2])
    if test_point[0]==-1 and test_point[1]==-1 and test_point[2]==-1:
        break
    elif test_point[0]==-1 or test_point[1]==-1:
        grade.append('F')
    elif test_point[0]+test_point[1]>=80:
        grade.append('A')
    elif test_point[0]+test_point[1]<80 and test_point[0]+test_point[1]>=65:
        grade.append('B')
    elif test_point[0]+test_point[1]<65 and test_point[0]+test_point[1]>=50:
        grade.append('C')
    elif test_point[0]+test_point[1]<50 and test_point[0]+test_point[1]>=30:
        if test_point[2]>=50:
            grade.append('C')
        else:
            grade.append('D')
    elif test_point[0]+test_point[1]<30:
        grade.append('F')

for i in range(0,len(grade)):
    print(grade[i])

Submission status: Accepted

Solution code:
scores = []
while True:
    score = list(map(int, input().split()))
    if score[0] == -1 and score[1] == -1 and score[2] == -1:
        break
    else:
        scores.append(score)

for i in scores:
    mid_exam = i[0]
    final_exam = i[1]
    re_exam = i[2]
    total = i[0] + i[1]
    if mid_exam == -1 or final_exam == -1:
        print("F")
    elif total >= 80:
        print("A")
    elif total in range(65, 80):
        print("B")
    elif total in range(50, 65):
        print("C")
    elif 30 <= total < 50:
        if re_exam >= 50:
            print("C")
        else:
            print("D")
    elif total < 30:
        print("F")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:

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

    total = m+f

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

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

Submission status: Accepted

Solution code:
while True:
    m,f,r=map(int,input().split())
    if m==f==r==-1:break
    a=m+f
    if m==-1 or f==-1:print('F')
    elif a >= 80:print('A')
    elif a >= 65:print('B')
    elif a >= 50:print('C')
    elif a >= 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

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

    elif 30<=m+f<50:
        print("D")

    else:
        print("F")

Submission status: Accepted

Solution code:
M, F, R = map(int, input().split())
while not (M == -1 and F == -1 and R == -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")

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

Submission status: Accepted

Solution code:
#! /usr/bin/env python
# -*- coding : utf-8 -*-
while True:
    m, f, r = map(int,input().split())
    if r == m == f == -1:
        break
    elif m == -1 or f == -1:
        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")
    elif m + f < 30:
        print("F")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# (c) midandfeed
while(1):
	m, f, r = [int(x) for x in input().split()]
	if(m+f+r == -3):
		break
	else:
		temp = m+f
		if( (m==-1) or (f==-1) ):
			print("F")
		elif (temp >= 80):
			print("A")
		elif (temp >= 65):
			print("B")			
		elif (temp >= 50):
			print("C")		
		elif (temp >= 30):
			if (r >= 50):
				print("C")
			else:
				print("D")
		else:
			print("F")

Submission status: Accepted

Solution code:
import sys

def seiseki(m, f, r):
    if m == -1 or f == -1:
        return "F"
    elif m + f >= 80:
        return "A"
    elif 65 <= m + f < 80:
        return "B"
    elif 50 <= m + f < 65:
        return "C"
    elif 30 <= m + f < 50:
        if r >= 50:
            return "C"
        return "D"
    elif m + f < 30:
        return "F"

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

    print seiseki(m, f, r)

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 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")

Submission status: Accepted

Solution code:
import sys
def main():
    for line in sys.stdin:
        m, f, r = map(int, line.split())
        if m == -1 and f == -1 and r == -1:
            break
        else:
            total = m + f
            if m == -1 or f == -1:
                print("F")
            elif total >= 80:
                print("A")
            elif 65 <= total < 80:
                print("B")
            elif 50 <= total < 65:
                print("C")
            elif 30 <= total < 50:
                if r >= 50:
                    print("C")
                else:
                    print("D")
            elif total < 30:
                print("F")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

    score_list = []
    while True:
        m, f, r = map(int, input().split())
        if [m, f, r] == [-1, -1, -1]: break
        score_list.append([m, f, r])
    
    for item in score_list:
        [m, f, r] = item
        total = m + f
        if [m, f, r] == [-1, -1, -1]: break
        elif m == -1 or f == -1:
            result = 'F'
        elif total < 30:
            result = 'F'
        elif total < 50:
            if r >= 50:
                result = 'C'
            else:
                result = 'D'
        elif total < 65:
            result = 'C'
        elif total < 80:
            result = 'B'
        else:
            result = 'A'
        print(result)

main()

Submission status: Accepted

Solution code:

while True:
    m,f,r=list(map(int,input().split()))
    if m==f==r==-1: break
    s=m+f
    print('F' if m*f<0 or s<30 else 'D' if 30<=s<50 and r<50 else 'C' if 50<=s<65 or 30<=s<50 and 50<=r else 'B' if 65<=s<80 else 'A')

Submission status: Accepted

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

    if m == -1 and f == -1 and r == -1:
        quit()
    elif 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')
    elif m + f < 30:
        print('F')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_A&lang=jp

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    while True:
        m, f, r = map(int, input().split())
        if m == -1 and f == -1 and r == -1:
            break
        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'
        print(grade)



if __name__ == '__main__':
    main(sys.argv[1:])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

import fileinput
import math

def main():

    while True:
        m, f, r = map(int, input().split())
        if ((m == -1) and (f == -1) and (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')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a=[]
w=""
while(w!="-1 -1 -1"):
    w=input()
    a.append(w)
a.pop()
for st in a:
    s=st.split()
    m=int(s[0])
    f=int(s[1])
    r=int(s[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 and r>=50):
        print("C")
    elif(m+f>=30 and r<50):
        print("D")
    else:
        print("F")

Submission status: Accepted

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

        if m == -1 or f == -1:
            print("F")
            continue

        m = m if m > -1 else 0
        f = f if f > -1 else 0
        r = r if r > -1 else 0
        mf = m + f

        if mf >= 80:
            print("A")
        elif 65 <= mf < 80:
            print("B")
        elif 50 <= mf < 65:
            print("C")
        elif 30 <= mf < 50:
            if r >= 50:
                print("C")
            else:
                print("D")
        else:
            print("F")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

res = []
while True:
    m, f, v = map(int, input().split())
    if m == f == v == -1:
        break;
    res.append(seiseki(m, f, v))

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

Submission status: Accepted

Solution code:
while 1:
 m,f,r=map(int,input().split())
 if m==f==r==-1:break
 if m==-1 or f==-1:print('F')
 elif m+f>79:print('A')
 elif m+f>64:print('B')
 elif m+f>49:print('C')
 elif m+f>29:print('C') if r>49 else print('D')
 else:print('F')

Submission status: Accepted

Solution code:
while 1:
 m,f,r=map(int,input().split());s=m+f
 if m==f==r==-1:break
 if m==-1 or f==-1:print('F')
 elif s>79:print('A')
 elif s>64:print('B')
 elif s>49:print('C')
 elif s>29:print('C') if r>49 else print('D')
 else:print('F')

Submission status: Accepted

Solution code:
while 1:
 m,f,r=map(int,input().split());s=m+f
 if m==f==r==-1:break
 if m==-1 or f==-1 or s<30:print('F')
 elif s>79:print('A')
 elif s>64:print('B')
 elif s>49 or r>49:print('C')
 else:print('D')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while 1:
 m,f,r=map(int,input().split());s=m+f
 if m==f==r<0:break
 if m*f<0 or s<30:print('F')
 elif s>79:print('A')
 elif s>64:print('B')
 elif s>49 or r>49:print('C')
 else:print('D')

Submission status: Accepted

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