목록PS/Python (269)
지나가던 개발자
s = input().split(" = ") if eval(s[0]) == int(s[1]): print("YES") else: print("NO")
n = int(input()) A = [False, False] + [True] * 7368788 Primes = [] for i in range(2, 7368788): if A[i]: Primes.append(i) for j in range(i+i, 7368788, i): A[j] = False print(Primes[n-1]) 에라토스테네스의 체 알고리즘을 사용했다. (덕분에 메모리가 145980KB...) 50만번째 소수는 7368788이다.
def power(A, n): res = 1 while n: if n % 2 != 0: res *= A A *= A n //= 2 return res def factorization(x): d = 2 factorization = [] while d
for i in range(int(input())): sequence = list(map(int, input().split()))[1:] if len(sequence) == 0: continue if len(sequence) == 1: print("The next 5 numbers after [" + str(sequence[0]) + "] are: [", end="") for i in range(1, 6): if i == 5: print(str(sequence[0]+i) + "]") continue print(str(sequence[0]+i) + ", ", end="") elif len(sequence) == 2: print("The next 5 numbers after [" + str(sequence[..
input() grade = list(map(int, input().split(" "))) m = max(grade) for i in range(len(grade)): grade[i] = grade[i]/m*100 print(sum(grade)/len(grade))
message = input() if message.count(":-)") == 0 and message.count(":-(") == 0: print("none") elif message.count(":-)") == message.count(":-("): print("unsure") elif message.count(":-)") > message.count(":-("): print("happy") else: print("sad") 파이썬은 PS 치트다...
x = input() if len(x) == 1: print(x) elif x[1] == "x": print(int(x, 16)) elif x[0] == "0": print(int(x, 8)) else: print(x)