본문 바로가기

python-algorithm1402

[백준] 9493 1 2 3 4 5 6 7 8 9 import sys while True: m,a,b=map(int, sys.stdin.readline().split()) if m==a==b==0: break sec=(m*( (b-a)/(a*b))*3600) h= int (sec//3600) mm= int (sec%3600)//60 ss= round ((sec%3600)%60 , 0) print("%.1d:%.2d:%.2d"%(h,mm,ss)) cs 2020. 12. 24.
[백준] 9469 1 2 3 4 import sys for _ in range (int(sys.stdin.readline())): tmp=list (map(float, sys.stdin.readline().split())) print("%d %.6f"%(int(tmp[0]),tmp[4]*tmp[1]/(tmp[2]+tmp[3]) )) cs 2020. 12. 24.
[백준] 9366 1 2 3 4 5 6 7 8 import sys for i in range(1,int(sys.stdin.readline())+1): tmp=sorted(map(int, sys.stdin.readline().split())) if tmp[0]+tmp[1] 2020. 12. 24.
[백준] 9325 1 2 3 4 5 6 7 8 import sys for i in range(int(sys.stdin.readline())): s=int(sys.stdin.readline()) numberO=int(sys.stdin.readline()) for j in range(numberO): a,b=map(int,sys.stdin.readline().split()) s+=a*b print(s) Colored by Color Scripter cs 2020. 12. 24.
[백준] 9295 1 2 3 4 import sys for i in range(1,int(sys.stdin.readline())+1): tmp=list(map(int,sys.stdin.readline().split())) print ("Case %d: %d"%(i,sum(tmp))) cs 2020. 12. 24.
[백준] 9094 1 2 3 4 5 6 7 8 9 10 import sys def sh(n,m): cnt=0 for a in range(1,n): for b in range(a+1,n): if (a**2+b**2+m)%(a*b)==0: cnt+=1 return cnt for _ in range(int(sys.stdin.readline())): n,m=map(int,sys.stdin.readline().split()) print(sh(n,m )) cs 엄청난 브루트 포스 방식입니다. python3 시간초과나서 pypy3로 채점했습니다.. sorry.. 2020. 12. 24.
[백준] 9085 1 2 3 4 5 import sys for _ in range(int(sys.stdin.readline())): dummy=sys.stdin.readline() tmp=list(map(int, sys.stdin.readline().split())) print(sum (tmp)) Colored by Color Scripter cs 2020. 12. 24.
[백준] 8932 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 import sys def track_100(p): return int(9.23076*pow((26.7-p),1.835 ) ) def track_200(p): return int(4.99087*pow((42.5-p),1.81 ) ) def track_800(p): return int(0.11193*pow((254-p),1.88 ) ) def field_n(p): return int(1.84523 * pow((p-75), 1.348)) def field_p(p): return int(56.0211 * pow((p-1.5), 1.05)) def field_m(p): return int(0.188807 * pow((p-210.. 2020. 12. 24.
[백준] 7770 1 2 3 4 5 6 7 8 import sys n=int(sys.stdin.readline()) h=0 block=0 while block 2020. 12. 24.
[백준] 7510 1 2 3 4 5 6 7 8 9 10 11 12 13 14 import sys def isRAT(a): if a[2]**2==a[1]**2+a[0]**2 : return 1 else: return 0 for i in range(1,int(sys.stdin.readline())+1): a=sorted(map(int, sys.stdin.readline().split())) print("Scenario #%d:"%i) if isRAT(a)==1: print("yes",'\n') else: print("no",'\n') Colored by Color Scripter cs 2020. 12. 24.
[백준] 6378 1 2 3 4 5 6 7 8 9 10 import sys sys.setrecursionlimit(10**6) def digitalroot(n): return sum(map(int,n)) if len(n) ==1 else digitalroot(str(sum(map(int,n)))) while True: n=input() if n=='0': exit() else : print (digitalroot(n)) Colored by Color Scripter cs 2020. 12. 24.
[백준] 6322 1 2 3 4 5 6 7 8 9 10 11 12 13 14 import sys import math cnt=1 while True: a,b,c=map(int,sys.stdin.readline().split()) if a==b and b==c and a==0: break elif (a>=c or b>=c) and c!=-1 : print("Triangle #%d"%cnt); print("Impossible.") elif a==-1: print("Triangle #%d"%cnt); print("a = %.3f"% (math.sqrt(pow(c,2)-pow(b,2)))) elif b == -1: print("Triangle #%d" % cnt); print("b = %.3f" % (math.sqrt(pow(c.. 2020. 12. 24.