Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- C
- Forensics
- HackCTF
- xcz.kr
- Python
- Network
- Web Hacking
- MySQL
- CTF
- Incognito
- wargame
- 백준
- misc
- cryptography
- 정렬
- 구현
- 그리디 알고리즘
- php
- writeup
- 문자열
- N0Named
- Web
- Text
- 써니나타스
- Database
- 사칙연산
- 인코그니토
- SuNiNaTas
- Digital Forensics
- 수학
Archives
- Today
- Total
보안을 그리다, 훈이
[Baekjoon/Python3] 10996번 별 찍기 - 21 본문
[Baekjoon/Python3] 10996번 별 찍기 - 21
10996번: 별 찍기 - 21
예제를 보고 규칙을 유추한 뒤에 별을 찍어 보세요.
www.acmicpc.net
n = int(input())
second = n // 2
first = n - n // 2
for i in range(n):
print('* ' * first)
print(' *' * second)
n = int(input())
for i in range(n * 2):
if n % 2 == 0 and i % 2 == 0:
print('* ' * (n // 2))
elif n % 2 == 0 and i % 2 != 0:
print(' *' * (n // 2))
elif n % 2 != 0 and i % 2 == 0:
print('* ' * (n // 2 + 1))
elif n % 2 != 0 and i % 2 != 0:
print(' *' * (n // 2))
n = int(input())
if n % 2 == 0:
for i in range(n * 2):
if i % 2 == 0:
print('* ' * (n // 2))
else:
print(' *' * (n // 2))
else:
for j in range(n * 2):
if j % 2 == 0:
print('* ' * (n // 2 + 1))
else:
print(' *' * (n // 2))
'Programming > Python & Data Structures' 카테고리의 다른 글
[Baekjoon/Python3] 11006번 남욱이의 닭장 (0) | 2020.12.07 |
---|---|
[Baekjoon/Python3] 10998번 A×B (0) | 2020.12.07 |
[Baekjoon/Python3] 10995번 별 찍기 - 20 (0) | 2020.12.07 |
[Baekjoon/Python3] 10991번 별 찍기 - 16 (0) | 2020.12.07 |
[Baekjoon/Python3] 10990번 별 찍기 - 15 (0) | 2020.12.07 |
Comments