728x90
반응형

다음 2주간 목표( ~ 10/14 ) : silver 1 으로 올라가기.. 

728x90
반응형

'백준 > solved.ac' 카테고리의 다른 글

# 1013 Contact  (0) 2020.10.02
# 1011 Fly me to the Alpha Centauri  (0) 2020.10.02
# 3003 # 3046 #5337 # 5338  (0) 2020.10.01
# 1000 #1001 # 1271 # 1550 # 2338 # 2475 # 2557 # 2558 # 2845 # 2914  (0) 2020.10.01
728x90
반응형

solved.ac/problems/level/1

 

solved.ac - 문제 › 레벨 › Bronze V

 

solved.ac

 

# 3003: 킹, 퀸, 룩, 비숍, 나이트, 폰

n = list(map(int,input().split()))
base = [1,1,2,2,2,8]

for i in range(len(n)): 
  print( base[i]-n[i], end=' ')

 

# 3046: R2

r1,s = map(int,input().split())
r2 = 2*s - r1 

print(r2)

 

# 5337: 웰컴

print(".  .   .") 
print("|  | _ | _. _ ._ _  _") 
print("|/\|(/.|(_.(_)[ | )(/.")

 

# 5338: 마이크로소프트 로고

print("       _.-;;-._")
print("'-..-'|   ||   |")
print("'-..-'|_.-;;-._|")
print("'-..-'|   ||   |")
print("'-..-'|_.-''-._|")

 

 

728x90
반응형

'백준 > solved.ac' 카테고리의 다른 글

# 1013 Contact  (0) 2020.10.02
# 1011 Fly me to the Alpha Centauri  (0) 2020.10.02
20201001  (0) 2020.10.01
# 1000 #1001 # 1271 # 1550 # 2338 # 2475 # 2557 # 2558 # 2845 # 2914  (0) 2020.10.01
728x90
반응형

# 1000: A+B

a,b = map(int,input().split())

print(a+b)

 

# 1001: A-B

a,b = map(int,input().split())

print(a-b)

 

# 1271: 엄청난 부자2 

n, m = map(int, input().split())

print(n//m)
print(n%m)

 

# 1550: 16진수 

print(int(input(),16))

 

# 2338: 긴자리 계산

a = int(input())
b = int(input())

print(a+b)
print(a-b)
print(a*b)

 

# 2475: 검증수 

n = list(map(int,input().split()))
sum = 0 
for i in n:
  sum += i*i

print(sum%10)

 

# 2557: Hello world! 

print("Hello World!")

 

# 2558: A+B -2

a = int(input())
b = int(input())

print(a+b)

 

# 2845: 파티가 끝나고 난 뒤

l,p = map(int,input().split())
data = list(map(int,input().split()))

for i in data:
  print( i - l*p, end=' ')

 

# 2914: 저작권

a, i = map(int,input().split())

print( a*(i-1)+1 )
728x90
반응형

'백준 > solved.ac' 카테고리의 다른 글

# 1013 Contact  (0) 2020.10.02
# 1011 Fly me to the Alpha Centauri  (0) 2020.10.02
20201001  (0) 2020.10.01
# 3003 # 3046 #5337 # 5338  (0) 2020.10.01
728x90
반응형

팰린드롬 : 앞 뒤가 똑같은 문자열. 

주어진 문자열이 팰린드롬인지 확인할 것. 대소문자 구분 x 영문자와 숫자만을 취급. 

 

ex ) 

INPUT = "A man, a plan, a canal: Panama"  

OUTPUT = True

 

INPUT = "0P"
OUTPUT = False 

class Solution:
    def isPalindrome(self, s: str) -> bool:
        real_s = []
        for i in s : 
            if 48<=ord(i)<=57 or 65<= ord(i) <=90 or 97<=ord(i)<=122 :
                real_s.append(i)
        
        for i in range( len(real_s)//2 ):
            if real_s[i].upper() != real_s[ len(real_s)-i-1 ].upper():
                return False 
        return True

 

tip!  

real_s.append(i)  할 때, real_s.append( i.upper() ) 로 리스트에 추가하면 더 효율적으로 코드를 작성할 수 있다. 

 

 

leetcode.com/problems/valid-palindrome/

 

Valid Palindrome - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

 

728x90
반응형
728x90
반응형

문자열 n 에서 m 을 제외한 문자열을 출력하시오. 

n = input()
m = input() 
k = 0 
p=''

for i in n : 
  if k == len(m) or i != m[k] :
    p = p + i 
    
  else:
    k += 1 

print(p)
728x90
반응형

+ Recent posts