-
Staircase해커랭크(HackerRank) 2018. 8. 19. 17:44반응형
1. 문제
2. 알고리즘
키워드 - 구현, 출력
3. 코드
123456789101112131415161718192021222324252627282930313233#include <bits/stdc++.h>using namespace std;/** Complete the staircase function below.*/void staircase(int n) {/** Write your code here.*/for(int i =0; i<n; i++) {for(int j =i; j<n-1; j++) {cout << " ";}for(int j =n-i-1; j<n; j++) {cout << "#";}cout << endl;}}int main(){int n;cin >> n;cin.ignore(numeric_limits<streamsize>::max(), '\n');staircase(n);return 0;}cs 반응형'해커랭크(HackerRank)' 카테고리의 다른 글
Diagonal Difference (0) 2018.08.19 Plus Minus (0) 2018.08.19 Mini-Max Sum (0) 2018.08.19 Birthday Cake Candles (0) 2018.08.19 Time Conversion (0) 2018.08.19