본문 바로가기

hacking sorcerer

(373)
2023년이 왔어요 #각 자리수 대로 합을 구하는 프로그램 #예 1) 1234 => 1+2+3+4=10 #예 2) 364 => 3+6+4=13 p = int(input()) def add_digits(n): sum = 0 while n > 0: sum += n % 10 n //= 10 return sum #print(add_digits(1234)) #print(add_digits(364)) print(add_digits(p)) import time current_time = time.time() print(current_time) seconds_since_2023 = current_time - time.mktime(time.strptime("2023-01-01 00:00:00", "%Y-%m-%d %H:%M:%S")) pr..
쿠키 한 사바리 드시고 가유~ class FunctionProblem: _test_cases = [] _solution = "" def check(self, function): for x_in, expected in self._test_cases: if function(*x_in) != expected: return False return True class EqualityCheckProblem: _vars = [] _default_values = [] def check(self, **kwargs): for var, default in zip(self._vars, self._default_values): if var not in kwargs or kwargs[var] == default: return False return True ..
데시멀바 #10진수를 입력받아 2진수로 출력 p = int(input()) def decimal_to_binary(decimal): binary = [] while decimal > 0: binary.append(decimal % 2) decimal //= 2 for item in reversed(binary): print(item, end="") decimal_to_binary(p) ''' p = int(input()) s = [] for i in (0, 100): s.append(p % 2) p = p // 2 i += 1 if p == 1: s.append(1) quit() if p == 0: quit() for item in reversed(s): # Print the item without any bla..
쿠푸 왕의 피라미드 for i in range(20): for j in range(20 - i - 1): print(" ", end="") for j in range(2 * i + 1): print("*", end="") print() for i in range(20): print("{:^40}".format("*" * (2 * i + 1)))
Tryhackme Road 이번에는 제가 아주 재미있게 풀었던 Tryhackme Road를 리뷰해보겠습니다 저는 짧은 시간을 쪼개서 리뷰에 중점을 두는 것이므로 자세한 설명은 다루지 않습니다. 자세한 설명은 다른 블로그를 참고해주세요 ~* 일단 뭐 이건 기본이죠? 그 다음 비밀번호를 바꾸어주는 곳에서 admin의 비밀번호를 버프스위트를 이용하여 바꿔버립니다 그 다음 다음 shell.php를 profile 안쪽에 넣어줍니다 오우야 재미있네요 mongo와 mysql이 있습니다. 안으로 파고듭니다. 야미 야미 대충 요로코롬 root 권한까지 탈취하면 모든 플래그를 얻을 수 있습니다.
삑궷츢(호그와트에서의 1시간) const moment = require('moment'); const now = moment(); const dateFormat = 'MMMM Do YYYY, h:mm:ss a'; console.log(`The current date and time is ${now.format(dateFormat)}.`); const dayOfWeek = now.format('dddd'); console.log(`Today is ${dayOfWeek}.`); const escapedYear = now.format('YYYY [escaped] YYYY'); console.log(`The current year is ${escapedYear}.`); const christmas = moment('2021-12-25'); ..
colleciparis import collections import string import requests def analyze_text(text): frequency = collections.Counter(text) total_chars = sum(frequency.values()) num_words = len(text) num_unique_words = len(set(text)) most_common_words = frequency.most_common(10) least_common_words = frequency.most_common()[:-11:-1] results = { 'total_chars': total_chars, 'num_words': num_words, 'num_unique_words': num_uniqu..
카뮈가 마시던 커퓌 # 제한 수를 상수로 설정한다 # 1~37 내에 무작위로 수를 만든다(무작위 수 하나는 단위 하나로 간주한다) # 무작위 수의 합이 제한 수를 넘지 않는 최대의 단위를 구한다 import random l = 120 k = int(input()) t = [] for i in range(k): random_number = random.randint(1, 37) t.append(random_number) print(random_number) count = 0 s = 0 #print(type(random_number)) for i in range(0, k): s += t[i] count += 1 if s == l: print(count) if s > l: count -= 1 print(count) break '..