update on Solver.countCGPA()Solver.countCGPA()Solver.countCGPA()Solver.countCGPA()
swadhinbiswas committed 1 years ago
89a4b16
1 parent 72d8a7a
commit 89a4b16
2 files changed
+43 -0
Showing 2 changed files+43-0
▼Toph.co/Byang's Day Out!.py
+27-0
| @@ -0,0 +1,27 @@ | ||
1 | +class Solve: | |
2 | + def tringleProblem(a:int,b:int,c:int)->None: | |
3 | + try: | |
4 | + x = a + b | |
5 | + y = b + c | |
6 | + z = a + c | |
7 | + | |
8 | + if(x >= c and y >= a and z >= b): | |
9 | + print("Yes") | |
10 | + else: | |
11 | + print("No") | |
12 | + except Exception: | |
13 | + return None | |
14 | + | |
15 | + | |
16 | + | |
17 | + | |
18 | +if __name__ == "__main__": | |
19 | + testcase=int(input()) | |
20 | + | |
21 | + for i in range(testcase): | |
22 | + a, b, c = map(int, input().split()) | |
23 | + if a<=100 and b<=100 and c<=100: | |
24 | + Solve.tringleProblem(a, b, c) | |
25 | + | |
26 | + | |
27 | + | |
0 | 28 | |
▼Toph.co/CGPA, the Golden Egg!.py
+16-0
| @@ -0,0 +1,16 @@ | ||
1 | +class Solve: | |
2 | + def countCGPA(): | |
3 | + for i in range(int(input())): | |
4 | + p=f=g=0 | |
5 | + for j in [1]*int(input()): | |
6 | + m,c=map(float,input().split());p+=c | |
7 | + if m<40:f+=1 | |
8 | + elif m>=80:g+=4*c | |
9 | + else:g+=c*(m//5)/4 | |
10 | + print("Case %d: %s"%(i+1,('%.2f'%(g/p),'Sorry, you have failed in %d course%s!'%(f,('s','')[f<2]))[f>0])) | |
11 | + | |
12 | + | |
13 | + | |
14 | + | |
15 | +if __name__ == '__main__': | |
16 | + Solve.countCGPA() | |
0 | 17 | |