Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions 3004.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
for i in range(int(input())):
a,b,c,d=map(int,input().split())
print("S") if (a<c and b<d) or (b<c and a<d) else print("N")
13 changes: 13 additions & 0 deletions 3005.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def emp(a,b):
if ((((a[0] < b[0]) and (a[1] < b[1])) or ((a[0] < b[1]) and (a[1] < b[0]))) or (((a[0] < b[1]) and (a[1] < b[2])) or ((a[0] < b[2]) and (a[1] < b[1]))) or (((a[0] < b[0]) and (a[1] < b[2])) or ((a[0] < b[2]) and (a[1] < b[0])))):return True
elif ((((a[1] < b[0]) and (a[2] < b[1])) or ((a[1] < b[1]) and (a[2] < b[0]))) or (((a[1] < b[1]) and (a[2] < b[2])) or ((a[1] < b[2]) and (a[2] < b[1]))) or (((a[1] < b[0]) and (a[2] < b[2])) or ((a[1] < b[2]) and (a[2] < b[0])))):return True
elif ((((a[0] < b[0]) and (a[2] < b[1])) or ((a[0] < b[1]) and (a[2] < b[0]))) or (((a[0] < b[1]) and (a[2] < b[2])) or ((a[0] < b[2]) and (a[2] < b[1]))) or (((a[0] < b[0]) and (a[2] < b[2])) or ((a[0] < b[2]) and (a[2] < b[0])))):return True
return False
for _ in range(int(input())):
x=list(map(int,input().split()))
p=[x[0],x[1],x[2]]
s=[x[3],x[4],x[5]]
if emp(p,s) and emp(s,p):print(3)
elif emp(p,s):print(1)
elif emp(s,p):print(2)
else:print(0)
13 changes: 13 additions & 0 deletions 3034.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def primo(n):
if n < 2:return False
if n%2==0:return False
k=3
while k*k<=n:
if n%k==0:return False
k+=2
return True
for _ in range(int(input())):
n=int(input())+1
if n<7:print("No")
elif n%7==0 and n%2!=0 and primo(n+2):print("Yes")
else:print("No")
9 changes: 9 additions & 0 deletions 3037.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
for _ in range(int(input())):
j=m=0
for joao in range(3):
x=list(map(int,input().split()))
j+=(x[0]*x[1])
for maria in range(3):
x=list(map(int,input().split()))
m+=(x[0]*x[1])
print("MARIA") if m>j else print("JOAO")
9 changes: 9 additions & 0 deletions 3038.py
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions 3040.py
Original file line number Diff line number Diff line change
@@ -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")
3 changes: 3 additions & 0 deletions 3056.py
Original file line number Diff line number Diff line change
@@ -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])
13 changes: 13 additions & 0 deletions 3068.py
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions 3126.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
n=int(input())
x=list(map(int,input().split()))
print(sum(x))
14 changes: 14 additions & 0 deletions 3134.py
Original file line number Diff line number Diff line change
@@ -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")
21 changes: 21 additions & 0 deletions 3135.py
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions 3145.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
n,x=map(int,input().split())
x=x/(n+2)
print("%.2f"%x)
1 change: 1 addition & 0 deletions 3146.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("%.2f" % (2*3.14*(float(input()))))
4 changes: 4 additions & 0 deletions 3147.py
Original file line number Diff line number Diff line change
@@ -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.")
22 changes: 22 additions & 0 deletions 3152.py
Original file line number Diff line number Diff line change
@@ -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")
5 changes: 5 additions & 0 deletions 3154.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions 3157.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
input()
print("Nao se refuta ciencia com opiniao")
41 changes: 41 additions & 0 deletions 3159.py
Original file line number Diff line number Diff line change
@@ -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="")
11 changes: 11 additions & 0 deletions 3161.py
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions 3170.py
Original file line number Diff line number Diff line change
@@ -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)')
15 changes: 15 additions & 0 deletions 3173.py
Original file line number Diff line number Diff line change
@@ -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}')
23 changes: 23 additions & 0 deletions 3174.py
Original file line number Diff line number Diff line change
@@ -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)
20 changes: 20 additions & 0 deletions 3176.py
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions 3182.py
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 4 additions & 0 deletions 3209.py
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions 3224.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jon = input()
doc = input()
print("go") if len(jon)>=len(doc) else print("no")
12 changes: 12 additions & 0 deletions 3257.py
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 12 additions & 0 deletions 3299.py
Original file line number Diff line number Diff line change
@@ -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))
2 changes: 2 additions & 0 deletions 3300.py
Original file line number Diff line number Diff line change
@@ -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")
10 changes: 10 additions & 0 deletions 3301.py
Original file line number Diff line number Diff line change
@@ -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")
6 changes: 6 additions & 0 deletions 3302.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
x = int(input())
i=1
while(x>=i):
r = int(input())
print("resposta %d: %d" % (i, r))
i=i+1
2 changes: 2 additions & 0 deletions 3303.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x = input()
print("palavrao") if len(x)>=10 else print("palavrinha")
6 changes: 6 additions & 0 deletions 3307.py
Original file line number Diff line number Diff line change
@@ -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")
18 changes: 18 additions & 0 deletions 3309.py
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 5 additions & 0 deletions 3311.py
Original file line number Diff line number Diff line change
@@ -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")
14 changes: 14 additions & 0 deletions 3312.py
Original file line number Diff line number Diff line change
@@ -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)}")
Loading