-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2180.py
More file actions
31 lines (26 loc) · 664 Bytes
/
2180.py
File metadata and controls
31 lines (26 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
problem: Travel to Mars in Primo Speed
https://www.urionlinejudge.com.br/judge/en/problems/view/2180
"""
def isPrime(n):
if ((n < 2) or ((n > 2) and (n % 2 == 0))):
return False
i = 3
while i * i <= n:
if isPrime(i):
if(n % i == 0):
return False
i = i + 2
return True
peso = int(input())
primos = []
n_teste = peso
while len(primos) < 10:
if isPrime(n_teste):
primos.append(n_teste)
n_teste = n_teste + 1
velocidade = sum(primos)
horas = int(60000000/velocidade)
dias = int(horas/24)
print('{:d} km/h'.format(velocidade))
print('{:d} h / {:d} d'.format(horas, dias))