Skip to content

Commit

Permalink
Post: 알고리즘 스터디 1주차 언어팀
Browse files Browse the repository at this point in the history
  • Loading branch information
auguaajh committed Oct 15, 2024
1 parent f24fcc5 commit 303489f
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions blog/_posts/2024-10-15-algo-w1-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
layout: post
thumbnail: https://github.com/sunbaklee/tech-blog/assets/105528907/61f561c9-a338-41e5-bcba-528b62a79766
title: "알고리즘 스터디 1주차"
date: 2024-10-15
tags: [Embedded]
author: 이준혁
---

# 백준 3303번 킹, 퀸, 룩, 비숍, 나이트, 폰

## 개선 전 코드
```
a, b, c, d, e, f = map(int, input().split())
aa = bb = cc = dd = ee = ff = 0
if a == 1:
aa = 0
else:
aa = -(a - 1)
if b == 1:
bb = 0
else:
bb = -(b - 1)
if c == 2:
cc = 0
else:
cc = -(c - 2)
if d == 2:
dd = 0
else:
dd = -(d - 2)
if e == 2:
ee = 0
else:
ee = -(e - 2)
if f == 8:
ff = 0
else:
ff = -(f - 8)
print(aa, bb, cc, dd, ee, ff)
```








## 개선 후 코드
```
a, b, c, d, e, f = map(int, input().split())
a = -(a -1)
b = -(b -1)
c = -(c - 2)
d = -(d - 2)
e = -(e - 2)
f = -(f - 8)
print(a, b, c, d, e, f)
```


# 백준 2446 별찍기

```
n = int(input())
for i in range(n):
for i in range(n):
print(' ' * i, end = '')
print('*' * (2 * (n - i) - 1))
for i in range(n-1):
print(' ' , end = '')
print('*' * (2*i+1))
```

0 comments on commit 303489f

Please sign in to comment.