8 条题解
-
2cxccxc LV 9 @ 2018-11-07 14:36:12
你们的代码都好长啊
#include <cstdio> #include <iostream> #include <cstring> using namespace std; double p[2][8]={4.5,4,3.5,3,2.5,2,1,0,5,4.5,4,3.5,2.5,2,1,0}; string c[8]={"A+","A","B+","B","C+","C","D","F"}; int n,m; int main() { cin>>n>>m; if(n>100.0) printf("Error"); else if(n>=95)cout<<c[0]<<endl<<p[m][0]; else if(n>=90)cout<<c[1]<<endl<<p[m][1]; else if(n>=85)cout<<c[2]<<endl<<p[m][2]; else if(n>=80)cout<<c[3]<<endl<<p[m][3]; else if(n>=75)cout<<c[4]<<endl<<p[m][4]; else if(n>=70)cout<<c[5]<<endl<<p[m][5]; else if(n>=60)cout<<c[6]<<endl<<p[m][6]; else if(n>=0)cout<<c[7]<<endl<<p[m][7]; else printf("Error"); return 0; }
-
02023-09-24 18:14:48@
把这道乱七八糟的分支结构尽可能的简化
(???)score=float(input()) point=0 #判断是否录入错误 if score>100 or score<0 : print("Error") else : #判断等级顺便预处理积分 if score>=90 : print("A",end="") point=4 elif score>=80 : print("B",end="") point=3 elif score>=70 : print("C",end="") point=2 elif score>=60 : print("D") point=1 else : print("E") point=0 #判断有没有必要加加号 if score%10>=5 and score>=70 : print("+") point+=0.5 else : print("") #判断是否需要积分优惠 if int(input())==1 and point>=3 : point+=0.5 #判断输出类型 if point%1==0 : print(int(point)) else : print(float(point))
有更简解法欢迎补充
打表就算了 -
02020-10-07 21:25:47@
python3
a=float(input()) b=int(input()) while True: if b==1 or b==0: break else: a=float(input()) b=int(input()) if a<60 and a>=0: c="F" d=0 print(c) print(d) elif a>=60 and a<70: c="D" d=1 print(c) print(d) elif a>=70 and a<75: c="C" d=2 print(c) print(d) elif a>=75 and a<80: c="C+" d=2.5 print(c) print(d) elif b==1 and a>=80 and a<85: c="B" d=3.5 print(c) print(d) elif b==0 and a>=80 and a<85: c="B" d=3 print(c) print(d) elif b==1 and a>=85 and a<90: c="B+" d=4 print(c) print(d) elif b==0 and a>=85 and a<90: c="B+" d=3.5 print(c) print(d) elif b==1 and a>=90 and a<95: c="A" d=4.5 print(c) print(d) elif b==0 and a>=90 and a<95: c="A" d=4 print(c) print(d) elif b==1 and a>=95 and a<=100: c="A+" d=5 print(c) print(d) elif b==0 and a>=95 and a<=100: c="A+" d=4.5 print(c) print(d) else: print("Error")
-
02020-09-21 17:23:45@
score=float(input()) C=int(input()) level=0 if C==1: if score<60 and score>=0: level="F" gpa=0 print(level) print(gpa) elif score<=70: level="D" gpa=1 print(level) print(gpa) elif score<=75: level="C" gpa=2 print(level) print(gpa) elif score<=80: level="C+" gpa=2.5 print(level) print(gpa) elif score<=85: level="B" gpa=3.5 print(level) print(gpa) elif score<=90: level="B+" gpa=4 print(level) print(gpa) elif score<=95: level="A" gpa=4.5 print(level) print(gpa) elif score<=100: level="A+" gpa=5 print(level) print(gpa) else: print("Error") elif C==0: if score<60 and score>=0: level="F" gpa=0 print(level) print(gpa) elif score<=70: level="D" gpa=1 print(level) print(gpa) elif score<=75: level="C" gpa=2 print(level) print(gpa) elif score<=80: level="C+" gpa=2.5 print(level) print(gpa) elif score<=85: level="B" gpa=3 print(level) print(gpa) elif score<=90: level="B+" gpa=3.5 print(level) print(gpa) elif score<=95: level="A" gpa=4 print(level) print(gpa) elif score<=100: level="A+" gpa=4.5 print(level) print(gpa) else: print("Error") else: print("Error")
-
02019-10-05 17:34:31@
s=float(input())
r=int(input())
if s<0 or s>100:
print('Error')
elif s<60:
print('F')
print('0')
elif s<70:
print('D')
print('1')
elif s<75:
print('C')
print('2')
elif s<80:
print('C+')
print('2.5')
elif s<85 and r==1:
print('B')
print('3.5')
elif s<85 and r==0:
print('B')
print('3')
elif s<90 and r==1:
print('B+')
print('4')
elif s<90 and r==0:
print('B+')
print('3.5')
elif s<95 and r==0:
print('A')
print('4')
elif s<95 and r==1:
print('A')
print('4.5')
elif s<=100 and r==1:
print('A+')
print('5')
elif s<=100 and r==0:
print('A+')
print('4.5') -
-12017-11-09 12:18:11@
score=float(input())
a=int(input())
if(a==0):
if(score>=95 and score<=100):
print("A+")
print("4.5")
elif(90<=score<95):
print("A")
print("4")
elif(85<=score<90):
print("B+")
print("3.5")
elif(80<=score<85):
print("B")
print("3")
elif(75<=score<80):
print("C+")
print("2.5")
elif(70<=score<75):
print("C")
print("2")
elif(60<=score<70):
print("D")
print("1")
elif(0<=score<60):
print("F")
print("0")
else:
print("Error")
if(a==1):
if(score>=95 and score<=100):
print("A+")
print("5")
elif(90<=score<95):
print("A")
print("4.5")
elif(85<=score<90):
print("B+")
print("4")
elif(80<=score<85):
print("B")
print("3.5")
elif(75<=score<80):
print("C+")
print("2.5")
elif(70<=score<75):
print("C")
print("2")
elif(60<=score<70):
print("D")
print("1")
elif(0<=score<60):
print("F")
print("0")
else:
print("Error") -
-12017-10-31 15:17:40@
score=float(input())
cata=int(input())
grade=0
if score>100 or score<0:
print('Error')
elif cata==0:
if 95<=score<=100:
grade='A+'
point=4.5
elif 90<=score<95:
grade='A'
point=4
elif 85<=score<90:
grade='B+'
point=3.5
elif 80<=score<85:
grade='B'
point=3
elif 75<=score<80:
grade='C+'
point=2.5
elif 70<=score<75:
grade='C'
point=2
elif 60<=score<70:
grade='D'
point=1
else :
grade='F'
point=0
print(grade)
print(point)
elif cata==1:
if 95<=score<=100:
grade='A+'
point=5
elif 90<=score<95:
grade='A'
point=4.5
elif 85<=score<90:
grade='B+'
point=4
elif 80<=score<85:
grade='B'
point=3.5
elif 75<=score<80:
grade='C+'
point=2.5
elif 70<=score<75:
grade='C'
point=2
elif 60<=score<70:
grade='D'
point=1
else :
grade='F'
point=0
print(grade)
print(point)
else:
print('Error') -
-22017-10-27 10:40:51@
a=float(input())
b=int(input())
0<=b<=1
if(a>100 or a<0):
print("Error")
elif(b==1):
if(a>=95):
print("A+")
print("5")
elif(a>=90):
print("A")
print("4.5")
elif(a>=85):
print("B+")
print("4")
elif(a>=80):
print("B")
print("3.5")
elif(a>=75):
print("C+")
print("2.5")
elif(a>=70):
print("C")
print("2")
elif(a>=60):
print("D")
print("1")
elif(a<60):
print("F")
print("0")
elif(b==0):
if(a>=95):
print("A+")
print("4.5")
elif(a>=90):
print("A")
print("4")
elif(a>=85):
print("B+")
print("3.5")
elif(a>=80):
print("B")
print("3")
elif(a>=75):
print("C+")
print("2.5")
elif(a>=70):
print("C")
print("2")
elif(a>=60):
print("D")
print("1")
elif(a<60):
print("F")
print("0")
- 1
信息
- 难度
- 7
- 分类
- (无)
- 标签
- (无)
- 递交数
- 1057
- 已通过
- 179
- 通过率
- 17%
- 上传者