개발자/C or C++

[백준] 2675번

Mosser 2021. 10. 1.
728x90
반응형

소스코드

#include <iostream>
#include <cstring>
using namespace std;

#define SIZE 21
#define ERR_TESTCASE -1 //if return -1, testCase is out of range
#define ERR_RECURSIVE -2 //if return -2 recursive is out of range

int main(){
    int testCase;
    cin>>testCase;
    if(testCase<1 || testCase>1000)
        return ERR_TESTCASE;

    int recursive;
    char str[SIZE];
    int i,j,k;
    int len;
    

    for(i=0;i<testCase;i++){

        cin>>recursive;
        if(recursive<1 || recursive>8)
            return ERR_RECURSIVE;
        cin>>str;
        len=strlen(str);

        for(j=0;j<len;j++){
            for(k=0;k<recursive;k++)
                cout<<str[j];
            
            
        }
        cout<<endl;


        

    }
    return 0;

}
반응형

'개발자 > C or C++' 카테고리의 다른 글

[백준] 1316번  (0) 2021.10.01
[백준] 1156번  (0) 2021.10.01
[백준] 10809번  (0) 2021.10.01
[백준] 10039번  (0) 2021.10.01
[백준] 2920번  (0) 2021.10.01

댓글