티스토리 뷰
문제 링크
https://www.acmicpc.net/problem/2443
2443번: 별 찍기 - 6
첫째 줄에는 별 2×N-1개, 둘째 줄에는 별 2×N-3개, ..., N번째 줄에는 별 1개를 찍는 문제 별은 가운데를 기준으로 대칭이어야 한다.
www.acmicpc.net
구현 코드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main(){ | |
int n; | |
cin >> n; | |
for(int i=0;i<n;i++){ | |
for(int j=0;j<i;j++){ | |
cout << ' '; | |
} | |
for(int k=i+1;k<n*2-i;k++){ | |
cout << '*'; | |
} | |
cout << endl; | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input()) | |
for i in range(n): | |
print(' ' * i, end='') | |
print('*'*((n*2)-(i*2+1))) |
'Coding Test > 백준' 카테고리의 다른 글
[C++/Python] 백준 2445 - 별 찍기 - 8 (0) | 2020.01.29 |
---|---|
[C++/Python] 백준 2444 - 별 찍기 - 7 (0) | 2020.01.28 |
[C++/Python] 백준 2442 - 별 찍기 - 5 (0) | 2020.01.26 |
[C++/Python] 백준 2441 - 별 찍기 - 4 (0) | 2020.01.25 |
[C++/Python] 백준 2440 - 별 찍기 - 3 (0) | 2020.01.24 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 알고스팟
- 두니발 박사의 탈옥
- Django
- 합친 lis
- 완전탐색
- HDFS
- import
- 백준
- 하둡
- python
- Jaeha's Safe
- 삼각형 위의 최대 경로
- 2225
- 외발 뛰기
- microwaving lunch boxes
- C++
- 배열과 문자열
- HiveQL
- Sqoop
- 출전 순서 정하기
- 분할정복
- 종만북
- hive
- 스파크
- 하이브
- Hadoop
- 코딩인터뷰 완전분석
- pyspark
- 팰린드롬 구하기
- 삼각형 위의 최대 경로 수 세기
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함