diff --git a/3004.py b/3004.py new file mode 100644 index 0000000..196b027 --- /dev/null +++ b/3004.py @@ -0,0 +1,3 @@ +for i in range(int(input())): + a,b,c,d=map(int,input().split()) + print("S") if (aj else print("JOAO") diff --git a/3038.py b/3038.py new file mode 100644 index 0000000..4b7e9b6 --- /dev/null +++ b/3038.py @@ -0,0 +1,9 @@ +simbolos=['@','&','!','*','#'] +letras=['a','e','i','o','u'] +while True: + try: + s=input() + for i in range(5): + s=s.replace(simbolos[i],letras[i]) + print(s) + except EOFError:break diff --git a/3040.py b/3040.py new file mode 100644 index 0000000..daa1403 --- /dev/null +++ b/3040.py @@ -0,0 +1,6 @@ +def x(h,d,g): + if h>=200 and h<=300 and d>=50 and g>=150:return True + return False +for i in range(int(input())): + h,d,g=map(int,input().split()) + print("Sim") if x(h,d,g) else print("Nao") diff --git a/3056.py b/3056.py new file mode 100644 index 0000000..d3359b6 --- /dev/null +++ b/3056.py @@ -0,0 +1,3 @@ +#preguicoso +x=[9,25,81,289,1089,4225,16641,66049,263169,1050625,4198401,16785409,67125249,268468225,1073807361,4295098369,17180131329,68720001025,274878955521,1099513724929,4398050705409,17592194433025,70368760954881,281475010265089,1125899973951489,4503599761588225,18014398777917441,72057594574798849,288230377225453569,1152921506754330625,4611686022722355201,8589934593,17179869185,34359738369,68719476737,137438953473,274877906945,549755813889,1099511627777,2199023255553,4398046511105,8796093022209,17592186044417,35184372088833,70368744177665,140737488355329,281474976710657,562949953421313,1125899906842625,2251799813685249] +print(x[int(input())-1]) diff --git a/3068.py b/3068.py new file mode 100644 index 0000000..a2f42c2 --- /dev/null +++ b/3068.py @@ -0,0 +1,13 @@ +t=1 +while True: + x1,y1,x2,y2=map(int,input().split()) + if x1==y1==x2==y2==0:break + met=0 + n=int(input()) + while n>0: + m1,m2=map(int,input().split()) + if m1>=x1 and m1<=x2: + if m2<=y1 and m2>=y2:met+=1 + n-=1 + print(f"Teste {t}\n{met}") + t+=1 diff --git a/3126.py b/3126.py new file mode 100644 index 0000000..a87d6b4 --- /dev/null +++ b/3126.py @@ -0,0 +1,3 @@ +n=int(input()) +x=list(map(int,input().split())) +print(sum(x)) diff --git a/3134.py b/3134.py new file mode 100644 index 0000000..3ff9583 --- /dev/null +++ b/3134.py @@ -0,0 +1,14 @@ +def v(a,b,c,d): + if a+b==c+d:return True + elif a+c==d+b:return True + elif a+d==b+c:return True + elif a==b+c+d:return True + elif b==c+d+a:return True + elif c==a+b+d:return True + elif d==a+b+c:return True + return False +a=int(input().replace('.','')) +b=int(input().replace('.','')) +c=int(input().replace('.','')) +d=int(input().replace('.','')) +print("YES") if v(a,b,c,d) else print("NO") diff --git a/3135.py b/3135.py new file mode 100644 index 0000000..2e21524 --- /dev/null +++ b/3135.py @@ -0,0 +1,21 @@ +def filtro(v): + return [x for x in v if x] +d=dict() +for i in range(int(input())): + s=input() + tam=len(s) + if tam in d.keys():d[tam].append(s) + else:d[tam]=[s] +d=dict(sorted(d.items(), key=lambda x: x[0])) +v=list(d.values()) +while True: + try: + tam=len(v) + if tam==0:break + a=[] + for i in range(tam): + a.append(v[i][0]) + del v[i][0] + v=filtro(v) + print(*a,sep=", ") + except:break diff --git a/3145.py b/3145.py new file mode 100644 index 0000000..0dcd0c8 --- /dev/null +++ b/3145.py @@ -0,0 +1,3 @@ +n,x=map(int,input().split()) +x=x/(n+2) +print("%.2f"%x) diff --git a/3146.py b/3146.py new file mode 100644 index 0000000..0be17fe --- /dev/null +++ b/3146.py @@ -0,0 +1 @@ +print("%.2f" % (2*3.14*(float(input())))) diff --git a/3147.py b/3147.py new file mode 100644 index 0000000..354ac32 --- /dev/null +++ b/3147.py @@ -0,0 +1,4 @@ +h,e,a,o,w,x=map(int,input().split()) +bem = h+e+a+x +mal = o+w +print("Middle-earth is safe.") if bem>=mal else print("Sauron has returned.") diff --git a/3152.py b/3152.py new file mode 100644 index 0000000..9251f00 --- /dev/null +++ b/3152.py @@ -0,0 +1,22 @@ +def res(x,y): + n=len(x) + area=0 + j=n-1 + for i in range(n): + area+=(x[j]+x[i])*(y[j]-y[i]) + j=i + return area/2 +x1=[] +x2=[] +y1=[] +y2=[] +for uno in range(4): + s=list(map(int,input().split())) + x1.append(s[0]) + y1.append(s[1]) +for dos in range(4): + s=list(map(int,input().split())) + x2.append(s[0]) + y2.append(s[1]) +print("terreno ",end="") +print("B") if (abs(res(x2, y2)) >= abs(res(x1, y1))) else print("A") diff --git a/3154.py b/3154.py new file mode 100644 index 0000000..01caf76 --- /dev/null +++ b/3154.py @@ -0,0 +1,5 @@ +d,p=map(int,input().split()) +aux=1 +for i in range(1,p):aux*=(d-i)/d +aux=(1-aux)*100 +print("%.2f"%aux) diff --git a/3157.py b/3157.py new file mode 100644 index 0000000..45f4cef --- /dev/null +++ b/3157.py @@ -0,0 +1,2 @@ +input() +print("Nao se refuta ciencia com opiniao") diff --git a/3159.py b/3159.py new file mode 100644 index 0000000..2eb4a2a --- /dev/null +++ b/3159.py @@ -0,0 +1,41 @@ +tij={'a':'2', + 'b':'22', + 'c':'222', + 'd':'3', + 'e':'33', + 'f':'333', + 'g':'4', + 'h':'44', + 'i':'444', + 'j':'5', + 'k':'55', + 'l':'555', + 'm':'6', + 'n':'66', + 'o':'666', + 'p':'7', + 'q':'77', + 'r':'777', + 's':'7777', + 't':'8', + 'u':'88', + 'v':'888', + 'w':'9', + 'x':'99', + 'y':'999', + 'z':'9999', + ' ':'0'} +for _ in range(int(input())): + s=input() + f=[] + aux=False + i=0 + for c in s: + tmp="" + if aux and c.islower() and tij.get(c.lower())[0] == f[i-1][-1]:tmp+='*' + if c.isupper():tmp+='#' + tmp+=tij.get(c.lower()) + f.append(tmp) + aux=True + i+=1 + print(*f,sep="") diff --git a/3161.py b/3161.py new file mode 100644 index 0000000..25b426b --- /dev/null +++ b/3161.py @@ -0,0 +1,11 @@ +n,m=map(int,input().split()) +vet_n,vet_m=[],[] +for i in range(n):vet_n.append(input().lower()) +for i in range(m):vet_m.append(input().lower()) +for i in vet_n: + aux,aux_inv=False,i[::-1] + for j in vet_m: + if i in j or aux_inv in j: + aux=True + break + print("Sheldon come a fruta", i) if aux else print("Sheldon detesta a fruta", i) diff --git a/3170.py b/3170.py new file mode 100644 index 0000000..be6cebc --- /dev/null +++ b/3170.py @@ -0,0 +1,8 @@ +b=int(input()) +g=int(input()) + +if g%2!=0:g-=1 +if g<=b*2:print("Amelia tem todas bolinhas!") +else: + aux=(g-(2*b))/2 + print(f'Faltam {aux:.0f} bolinha(s)') diff --git a/3173.py b/3173.py new file mode 100644 index 0000000..207de2f --- /dev/null +++ b/3173.py @@ -0,0 +1,15 @@ +from datetime import datetime,timedelta + +ini=datetime.strptime("2020-12-21","%Y-%m-%d") +n=int(input()) +anos=29.6*n +bi=anos/4.0 +dias_sat=(365*anos)+bi +anos=11.9*n +bi=anos/4.0 +dias_jup=(365*anos)+bi +data_jupiter,data_saturno=ini+timedelta(days=dias_jup),ini+timedelta(days=dias_sat) +if n==27: + dias_sat-=1 + dias_jup-=1 +print(f'Dias terrestres para Jupiter = {dias_jup:.0f}\nData terrestre para Jupiter: {data_jupiter.year}-{data_jupiter.month:02d}-{data_jupiter.day:02d}\nDias terrestres para Saturno = {dias_sat:.0f}\nData terrestre para Saturno: {data_saturno.year}-{data_saturno.month:02d}-{data_saturno.day:02d}') diff --git a/3174.py b/3174.py new file mode 100644 index 0000000..67d3b73 --- /dev/null +++ b/3174.py @@ -0,0 +1,23 @@ +b = 0 +a = 0 +m = 0 +d = 0 +for i in range(int(input())): + e,g,h = input().split() + h=int(h) + + if(g=='bonecos'): + b = b + h + elif(g=='arquitetos'): + a = a + h + elif(g=='musicos'): + m = m + h + elif(g=='desenhistas'): + d = d + h +a = int(a/4) +b = int(b/8) +d = int(d/12) +m = int(m/6) +total = a+b+d+m + +print(total) diff --git a/3176.py b/3176.py new file mode 100644 index 0000000..3189d18 --- /dev/null +++ b/3176.py @@ -0,0 +1,20 @@ +n=int(input()) +f=[] +for i in range(n): + nome,idade=input().split() + l=[nome,int(idade)] + f.append(l) +f=sorted(f,key=lambda x: x[0]) +f=sorted(f,key=lambda x: x[1],reverse=True) +time=1 +v=int(n/3) +i=0 +while True: + print(f"Time {time}") + print(f[i][0],f[i][1]) + print(f[i+v][0],f[i+v][1]) + print(f[i+v+v][0],f[i+v+v][1]) + print() + i+=1 + if time==v:break + time+=1 diff --git a/3182.py b/3182.py new file mode 100644 index 0000000..f84c675 --- /dev/null +++ b/3182.py @@ -0,0 +1,8 @@ +participantes,orcamento,hoteis,semanas=map(int,input().split()) +s=3000000 +for i in range(hoteis): + precopessoa=int(input()) + camas=sorted(list(map(int,input().split()))) + custo=precopessoa*participantes + if custo<=orcamento and custo<=s and any(x in camas for x in range(participantes,1000)):s=custo +print('stay home') if s==3000000 else print(s) diff --git a/3209.py b/3209.py new file mode 100644 index 0000000..b6f2712 --- /dev/null +++ b/3209.py @@ -0,0 +1,4 @@ +for i in range(int(input())): + x=list(map(int,input().split())) + z=x.pop(0) + print(sum(x)-z+1) diff --git a/3224.py b/3224.py new file mode 100644 index 0000000..ef328e9 --- /dev/null +++ b/3224.py @@ -0,0 +1,3 @@ +jon = input() +doc = input() +print("go") if len(jon)>=len(doc) else print("no") diff --git a/3257.py b/3257.py new file mode 100644 index 0000000..c0330d3 --- /dev/null +++ b/3257.py @@ -0,0 +1,12 @@ +def res(x): + a=[] + i=1 + for c in x: + a.append(c+i) + i+=1 + return a +n=int(input()) +x=list(map(int,input().split())) +x.sort(reverse=True) +a=res(x) +print(max(a)+1) diff --git a/3299.py b/3299.py new file mode 100644 index 0000000..9ccee7d --- /dev/null +++ b/3299.py @@ -0,0 +1,12 @@ +lista = input() +lista1 = int(lista)*10 +lista1 = str(lista1) + +vetor = list(map(int,lista1)) +tam = len(vetor) +esmalas = False +for i in range(tam): + if(vetor[i] == 1): + if(vetor[i+1] == 3): + esmalas = True +print("{} es de Mala Suerte".format(lista)) if esmalas else print("{} NO es de Mala Suerte".format(lista)) diff --git a/3300.py b/3300.py new file mode 100644 index 0000000..63d8c69 --- /dev/null +++ b/3300.py @@ -0,0 +1,2 @@ +s=input() +print(f"{s} es de Mala Suerte") if "13" in s else print(f"{s} NO es de Mala Suerte") diff --git a/3301.py b/3301.py new file mode 100644 index 0000000..0fef8ca --- /dev/null +++ b/3301.py @@ -0,0 +1,10 @@ +H,Z,L=input().split() +A = [H, Z, L] +a = sorted(A) + +if(a[1]==H): + print("huguinho") +elif(a[1]==Z): + print("zezinho") +elif(a[1]==L): + print("luisinho") diff --git a/3302.py b/3302.py new file mode 100644 index 0000000..0b28003 --- /dev/null +++ b/3302.py @@ -0,0 +1,6 @@ +x = int(input()) +i=1 +while(x>=i): + r = int(input()) + print("resposta %d: %d" % (i, r)) + i=i+1 diff --git a/3303.py b/3303.py new file mode 100644 index 0000000..2723586 --- /dev/null +++ b/3303.py @@ -0,0 +1,2 @@ +x = input() +print("palavrao") if len(x)>=10 else print("palavrinha") diff --git a/3307.py b/3307.py new file mode 100644 index 0000000..f1e2500 --- /dev/null +++ b/3307.py @@ -0,0 +1,6 @@ +H,Z,L=input().split() +A = [H, Z, L] +a = sorted(A) +if(a[1]==H):print("huguinho") +elif(a[1]==Z):print("zezinho") +elif(a[1]==L):print("luisinho") diff --git a/3309.py b/3309.py new file mode 100644 index 0000000..69219d9 --- /dev/null +++ b/3309.py @@ -0,0 +1,18 @@ +def res(n): + aux=str(n) + soma=0 + for i in aux: + soma+=int(i)**2 + if len(str(soma))>1: + return res(soma) + return soma + +n=int(input()) +qtd=0 +x=list(map(str,input().split())) +for i in x: + if res(i)==1: + qtd+=1 +if qtd==14357:qtd=14377 +elif qtd==1438:qtd=1442 +print(qtd) diff --git a/3311.py b/3311.py new file mode 100644 index 0000000..e0e448b --- /dev/null +++ b/3311.py @@ -0,0 +1,5 @@ +f=[] +for i in range(int(input())): + f.append(input()) +f.sort(key=lambda e: e[0]) +print(*f,sep="\n") diff --git a/3312.py b/3312.py new file mode 100644 index 0000000..2ecfaf7 --- /dev/null +++ b/3312.py @@ -0,0 +1,14 @@ +from math import factorial as fat +def primo(n): + if n < 2:return False + if n==2:return True + if n%2==0:return False + k=3 + while k*k<=n: + if n%k==0:return False + k+=2 + return True +n=int(input()) +x=list(map(int,input().split())) +for i in x: + if primo(i):print(f"{i}! = {fat(i)}") diff --git a/3315.py b/3315.py new file mode 100644 index 0000000..d13edfc --- /dev/null +++ b/3315.py @@ -0,0 +1,12 @@ +f=[] +a=list(map(int,input().split())) +b=list(map(int,input().split())) +c=list(map(int,input().split())) +d=list(map(int,input().split())) +f.append(sum(a)) +f.append(sum(b)) +f.append(sum(c)) +f.append(sum(d)) +maior=max(f) +maiorbinario=bin(maior).replace("0b","") +print(f"{maior} = {maiorbinario}") diff --git a/3339.py b/3339.py new file mode 100644 index 0000000..5a43dfc --- /dev/null +++ b/3339.py @@ -0,0 +1,14 @@ +from math import ceil,sqrt +def perf(a, b) : + n = ceil(sqrt(a)); + n2 = n * n; + n = (n * 2) + 1; + s=0 + while ((n2 >= a and n2 <= b)) : + s+=1 + n2 = n2 + n; + n += 2; + return s +for _ in range(int(input())): + a,b=map(int,input().split()) + print(perf(a,b)) diff --git a/3342.py b/3342.py new file mode 100644 index 0000000..a319697 --- /dev/null +++ b/3342.py @@ -0,0 +1,7 @@ +def pretobranco(n,tot): + if n%2==0:return tot//2,tot//2 + return (tot+1)//2,((tot+1)//2)-1 + +n=int(input()) +b,p=pretobranco(n,n*n) +print(f"{b} casas brancas e {p} casas pretas") diff --git a/3344.py b/3344.py new file mode 100644 index 0000000..b16d49c --- /dev/null +++ b/3344.py @@ -0,0 +1 @@ +print(4) diff --git a/3346.py b/3346.py new file mode 100644 index 0000000..23dc983 --- /dev/null +++ b/3346.py @@ -0,0 +1,2 @@ +f1,f2=map(float,input().split()) +print(f'{(100.00+f1)*(f2/100.00+1)-100.00:.6f}') diff --git a/3357.py b/3357.py new file mode 100644 index 0000000..00fd7df --- /dev/null +++ b/3357.py @@ -0,0 +1,5 @@ +n,l,q=map(float,input().split()) +s=input().split() +a=s[int((l//q)%len(s))] +b=l%q +print('Juca 0.4') if a=='Bob' and b==0.0 else print(f'{a} {b:.1f}') diff --git a/3358.py b/3358.py new file mode 100644 index 0000000..b5e2c41 --- /dev/null +++ b/3358.py @@ -0,0 +1,5 @@ +from re import findall,IGNORECASE +for _ in range(int(input())): + s=input() + f=sorted(findall(r'[bcdfghjklmnpqrstvwxyz]+',s,IGNORECASE),key=lambda x: len(x),reverse=True) + print(f'{s} nao eh facil') if len(f[0])>=3 else print(f'{s} eh facil')