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: Wrong Answer

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<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 and r>=50):
        print("C")
    elif(m+f<50 and m+f>=35 and r<50):
        print("D")
    else:
        print("F")

Submission status: Wrong Answer

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

Solution code:
while True:
    m, f, r  = [int(_) for _ in input().split()]
    if m == f == r == -1:
        break

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

Submission status: Wrong Answer

Solution code:
while True:
    m, f, r  = [int(_) for _ in input().split()]
    if m == f == r == -1:
        break

    if m == -1 or f == -1:
        rank = "F"
    elif (m + f) >= 80:
        rank = "A"
    elif 65 <= (m + f) < 80:
        rank = "B"
    elif 50 <= (m + f) < 65:
        rank = "C"
    elif 30 <= (m + f) < 50:
        if r >= 50:
            rank = "C"
        else:
            rank = "D"
    else:
        rank = "F"
    print("{:f}".format(m + f), str(m + f), rank)

Submission status: Wrong Answer

Solution code:
result = []
while True:
    info = [int(n) for n in input().split()]
    if info[0]==info[1]==info[2]==-1:
        break
    elif info[0] + info[1] >= 80:
        result.append("A")
    elif 65 <= info[0] + info[1] < 80:
        result.append("B")
    elif 50 <= info[0] + info[1] < 65:
        result.append("C")
    elif 35 <= info[0] + info[1] < 50 and info[2] >= 50:
        result.append("C")
    elif 35 <= info[0] + info[1] < 50:
        result.append("D")
    else:
        result.append("F")
for i in result:
    print(i)

Submission status: Wrong Answer

Solution code:
result = []
while True:
    info = [int(n) for n in input().split()]
    if info[0]==info[1]==info[2]==-1:
        break
    elif -1 in info[:2]:
        result.append("F")
    elif info[0] + info[1] >= 80:
        result.append("A")
    elif 65 <= info[0] + info[1] < 80:
        result.append("B")
    elif 50 <= info[0] + info[1] < 65:
        result.append("C")
    elif 35 <= info[0] + info[1] < 50 and info[2] >= 50:
        result.append("C")
    elif 35 <= info[0] + info[1] < 50:
        result.append("D")
    else:
        result.append("F")
for i in result:
    print(i)

Submission status: Wrong Answer

Solution code:
# AOJ ITP1_7_A

def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    while True:
        data = numinput()
        if data[0] < 0 and data[1] < 0 and data[2] < 0: break
        grade = ""
        if data[0] + data[1] >= 80: grade = "A"
        elif data[0] + data[1] >= 65: grade = "B"
        elif data[0] + data[1] >= 50: grade = "C"
        elif data[0] + data[1] >= 30:
            if data[2] < 0: grade = "D"
            else: grade = "C"
        else:
            grade = "F"
        if data[0] < 0 or data[1] < 0: grade = "F"
        print(grade)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

Solution code:
def evl_score(m,f,r):
    if m + f >= 80:
        ret = 'A'
    elif m + f >= 65 and m + f < 80:
        ret = 'B'
    elif m + f >= 50 and m + f < 65:
        ret = 'C'
    elif m + f >= 30 and m + f < 50:
        if r >= 50:
            ret = 'C'
        else: 
            ret = 'D'
    else:
        ret = 'F'
    return ret


m,f,r =[int(i) for i in input().split(' ')]
while m != -1:
    m,f,r =[int(i) for i in input().split(' ')]
    print(evl_score(m,f,r))

Submission status: Wrong Answer

Solution code:
def evl_score(m,f,r):
    if m + f >= 80:
        ret = 'A' 
    elif m + f >= 65 and m + f < 80:
        ret = 'B' 
    elif m + f >= 50 and m + f < 65: 
        ret = 'C' 
    elif m + f >= 30 and m + f < 50: 
        if r >= 50: 
            ret = 'C' 
        else:
            ret = 'D' 
    else: ret = 'F'
    return ret 
m,f,r =[int(i) for i in input().split(' ')] 
while not (m == -1 and f == -1 and r == -1): 
    m,f,r =[int(i) for i in input().split(' ')] 
    print(evl_score(m,f,r))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
while True:
	m, f, r = list(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 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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Time Limit Exceeded

Solution code:
import sys

while True:
	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 and r!=-1:
			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:
def grade(m, f, r):
    if m == -1 or f == -1:
        return 'F'

    if 80 <= m+f:
        return 'A'

    if 65 <= m+f:
        return 'B'

    if 50 <= m+f:
        return 'C'

    if 30 <= m+f:
        return 'C' if 50 <= r else 'D'

    return 'F'

def main():
    while True:
        m, f, r = [int(x) for x in input().split()]
        if m == f == r == -1:
            break

        print(grade(m,f,r))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():

    while True:
        m, f, r = tuple(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')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():

    while True:
        m, f, r = tuple(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')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    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')
        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')
        else:
            print('F')
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
flag = 1
all_tes_date = []
jag = []
while flag:
    tes_date = [int(tes) for tes in input().split()]
    if tes_date == [-1,-1,-1]:
        flag = 0
    else:
        all_tes_date.append(tes_date)

for tes_jag in all_tes_date:
    if (tes_jag[0] + tes_jag[1]) > 79:
        jag.append('A')
    elif (tes_jag[0] + tes_jag[1]) > 64:
        jag.append('B')
    elif ((tes_jag[0] + tes_jag[1]) > 49):
        jag.append('C')
    elif (tes_jag[0] + tes_jag[1]) > 29 and not(tes_jag[0] == -1) and not(tes_jag[1] == -1):
        if tes_jag[2] > 49:
            jag.append('C')
        else:
            jag.append('D')
    elif ((tes_jag[0] + tes_jag[1]) < 30) or (tes_jag[0] == -1) or (tes_jag[1] == -1):
        jag.append('F')
        
for jag_rs in jag:
    print(jag_rs)

Submission status: Accepted

Solution code:
one = [int(i) for i in input().split()]
data = []
while one != [-1, -1, -1]:
    data.append(one)
    one = [int(i) for i in input().split()]

answer = ['F' if i[0] == -1 or i[1] == -1 else 'A' if i[0] + i[1] >= 80 else 'B' if 65 <= i[0] + i[1] < 80 else 'C' if 50 <= i[0] + i[1] < 65 else 'C' if 30 <= i[0] + i[1] < 50 and 50 <= i[2] else 'D' if 30 <= i[0] + i[1] < 50 else 'F' for i in data]
print(*answer, sep="\n")

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, 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:
b = []

while True:
    inp = input()
    a = inp.split()
    a[0] = int(a[0])
    a[1] = int(a[1])
    a[2] = int(a[2])
    if a[0] == -1 and a[1] == -1 and a[2] == -1:
        break
    else:
        b.append(a)

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

Submission status: Accepted

Solution code:
# coding: utf-8

while True:
    m, f, r = map(int, input().split())
    
    if m + f + r == -3:
        exit()

    if m == -1 or f == -1 or (m + f < 30):
        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')

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

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 80 <= a+b:
        print('A')
        continue
    elif 65 <= a+b:
        print('B')
        continue
    elif 50 <= a+b:
        print('C')
        continue
    elif 30 <= a+b:
        if 50 <= c:
            print('C')
            continue
        else:
            print('D')
            continue
    elif a+b<30: print('F')

Submission status: Accepted

Solution code:
from sys import maxsize

def calc(m, f, r):
    border = [80, 65, 50, 30]
    grade = ["A", "B", "C", "D", "F"]

    if min(m, f) == -1:
        return grade[-1]
    if r >= 50:
        border[grade.index("C")] = -1 * maxsize

    i = 0
    while i < len(border) and m + f < border[i]:
        i += 1

    return grade[i]

ans = []
while True:
    m, f, r = map(int, input().split())
    if max(m, f, r) == -1:
        break
    ans.append(calc(m, f, r))

print("\n".join(ans))

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, input().split())
    score = ""
    if all([x < 0 for x in [m, f, r]]):
        break
    if any([x < 0 for x in [m, f]]):
        score = "F"
    elif 80 <= m+f:
        score = "A"
    elif 65 <= m+f:
        score = "B"
    elif 50 <= m+f or (30 <= m+f and 50 <= r):
        score = "C"
    elif 30 <= m+f:
        score = "D"
    else:
        score = "F"
    print(score)

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

for result in results:
    print(result)

Submission status: Accepted

Solution code:
results = []
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:
        results.append('F')
    elif m + f >= 80:
        results.append('A')
    elif m + f >= 65:
        results.append('B')
    elif m + f >= 50:
        results.append('C')
    elif m + f >= 30:
        if r >= 50:
            results.append('C')
        else:
            results.append('D')
    else:
        results.append('F')

for result in results:
    print(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 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:
marks=[]
while True:
    s=input().split()
    marks.append(s)
    if ["-1","-1","-1"] in marks:
        break
marks=marks[:-1]
for i in marks:
    if int(i[0])==-1 or int(i[1])==-1:
        print("F")
    elif int(i[0])+int(i[1])>=80:
        print("A")
    elif 65<=int(i[0])+int(i[1])<80:
        print("B")
    elif 50<=int(i[0])+int(i[1])<65:
        print("C")
    elif 30<=int(i[0])+int(i[1])<50:
        if int(i[2])>=50:
            print("C")
        else:
            print("D")
    elif int(i[0])+int(i[1])<30:
        print("F")

Submission status: Accepted

Solution code:
readline = open(0).readline
ans = []
while 1:
    m, f, r = map(int, readline().split())
    if m == f == r == -1:
        break
    v = m+f
    if m == -1 or f == -1 or v < 30:
        ans.append("F\n")
    elif v >= 80:
        ans.append("A\n")
    elif v >= 65:
        ans.append("B\n")
    elif v >= 50 or (v >= 30 and r >= 50):
        ans.append("C\n")
    else:
        ans.append("D\n")
open(1, 'w').writelines(ans)

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

Submission status: Accepted

Solution code:
from sys import stdin

def score(mid, fin, re):
    if mid == -1 or fin == -1:
        return "F"
    elif (mid+fin) >= 80:
        return "A"
    elif (mid+fin) >= 65:
        return "B"
    elif (mid+fin) >= 50:
        return "C"
    elif (mid+fin) >= 30:
        if re >= 50:
            return "C"
        else:
            return "D"
    else:
        return "F"

while True:
    m, f, r = [int(x) for x in stdin.readline().rstrip().split()]
    if m == -1 and f == -1 and r == -1:
        break
    else:
        print(score(m, f, r))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
score = []

# 提出用の入力
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    score.append((m, f, r))

# # 動作確認用の入力
# with open('input_itp1_7_a_1.txt', mode='r', encoding='utf8') as input:
#     while True:
#         m, f, r = map(int, next(input).split())
#         if m == -1 and f == -1 and r == -1:
#             break
#         score.append((m, f, r))
# print(score)

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

Submission status: Accepted

Solution code:
score = []

# 提出用の入力
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    score.append((m, f, r))

# # 動作確認用の入力
# with open('input_itp1_7_a_1.txt', mode='r', encoding='utf8') as input:
#     while True:
#         m, f, r = map(int, next(input).split())
#         if m == -1 and f == -1 and r == -1:
#             break
#         score.append((m, f, r))
# print(score)

for i in range(len(score)):
    sum = score[i][0] + score[i][1]
    if score[i][0] == -1 or score[i][1] == -1 or sum < 30:
        print('F')
    elif sum >= 80:
        print('A')
    elif sum >= 65:
        print('B')
    elif sum >= 50:
        print('C')
    elif sum >= 30:
        if score[i][2] >= 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 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:
midScore =[0]*50
finScore = [0]*50
reScore = [0]*50
personNum = 0
while True:
    m,f,r = map(int,input().split())
    midScore[personNum] = m
    finScore[personNum] = f
    reScore[personNum] = r
    personNum += 1
    if m is f is r is -1:
        break
    
    
for person in range(personNum):
    totalScore = midScore[person] + finScore[person]
    if midScore[person] is finScore[person] is reScore[person] is -1:
        pass
    elif midScore[person] == -1 or finScore[person] == -1:
        print("F")
    elif 80<=totalScore:
        print("A")
    elif 65<=totalScore<80:
        print("B")
    elif 50<=totalScore<65:
        print("C")
    elif 30<=totalScore<50:
        if 50<=reScore[person]:
            print("C")
        else:
            print("D")
    elif totalScore<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
    
    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 and r>=50:
        print("C")
    elif m+f>=30 and m+f<50:
        print("D")
    elif m+f<30:
        print("F")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding: UTF-8

while True:
    N = list(map(int, input().split()))

    total_score = N[0] + N[1]
    
    if N[0] == -1 and N[1] == -1 and N[2] == -1:
        break
    if N[0] == -1 or N[1] == -1:
        print('F')
    elif total_score >= 80:
        print('A')
    elif 80 > total_score >= 65:
        print('B')
    elif 65 > total_score >= 50:
        print('C')
    elif 50 > total_score >= 30:
        if N[2] >= 50:
            print('C')
        elif 50 > N[2]:
            print('D')
    elif 30 > total_score:
        print('F')

Submission status: Accepted

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

Submission status: Accepted

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