Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 편스토랑
- hackerrank
- 프로그래머스 파이썬
- 금융문자분석경진대회
- Git
- 맥북
- PYTHON
- 데이콘
- Docker
- dacon
- 자연어처리
- ChatGPT
- Real or Not? NLP with Disaster Tweets
- 파이썬
- 더현대서울 맛집
- 코로나19
- programmers
- gs25
- 캐치카페
- 프로그래머스
- SW Expert Academy
- leetcode
- github
- ubuntu
- 백준
- Baekjoon
- 편스토랑 우승상품
- AI 경진대회
- 우분투
- Kaggle
Archives
- Today
- Total
솜씨좋은장씨
[BaekJoon] 15873번 : 공백 없는 A+B (Python) 본문
728x90
반응형
코딩 1일 1문제! 오늘의 문제는 공백 없는 A+B입니다.
👨🏻💻 코드 ( Solution )
def no_space_A_plus_B(AB):
answer = 0
if len(AB) == 2:
answer = int(AB[0]) + int(AB[1])
elif len(AB) == 3:
A = int(AB[0]) if AB[1] != '0' else int(AB[:2])
B = int(AB[2]) if A == 10 else int(AB[1:])
answer = A + B
elif len(AB) == 4:
answer = 20
return answer
if __name__ == "__main__":
AB = input()
print(no_space_A_plus_B(AB))
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[BaekJoon] 11024번 : 더하기 4 (Python) (0) | 2022.01.09 |
---|---|
[BaekJoon] 3046번 : R2 (Python) (0) | 2022.01.08 |
[BaekJoon] 10988번 : 팰린드롬인지 확인하기 (Python) (0) | 2022.01.06 |
[BaekJoon] 5543번 : 상근날드 (Python) (0) | 2022.01.05 |
[BaekJoon] 11866번 : 요세푸스 문제 0 (Python) (0) | 2022.01.04 |
Comments