본문 바로가기

Algorithm/Implementation

(C++) - 백준(BOJ) 17010 : Time to Decompress

반응형

https://www.acmicpc.net/problem/17010

 

17010번: Time to Decompress

The output should be L lines long. Each line should contain the decoding of the corresponding line of the input. Specifically, if line i+1 of the input contained N x, then line i of the output should contain just the character x printed N times.

www.acmicpc.net

 

간단한 구현 문제였습니다.

📕 풀이방법

📔 입력 및 초기화

적절히 선언 후 입력 받습니다.

📔 정답출력

필요한 문자를 개수만큼 출력해줍니다.


📕 Code

#include <bits/stdc++.h>
using namespace std;

int t, n;
char c;

int main(){
  cin >> t;
  while(t--){
    cin >> n >> c;
    while(n--) cout << c;
    cout << '\n';
  }
}

*더 나은 내용을 위한 지적, 조언은 언제나 환영합니다.