Algorithm
[BOJ 2675] 문자열 반복
승우승
2019. 4. 15. 12:20
반응형
문제출처
https://www.acmicpc.net/problem/2675
문제풀이
이중 for문을 사용하면 되는 간단한 문제
소스코드
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <stdio.h> #include <cstring> int main() { int tc, repeat, len; char s[21]; scanf("%d", &tc); while(tc--) { scanf("%d %s", &repeat, &s); len=strlen(s); for(int i=0; i<len; i++) { for(int j=0; j<repeat; j++) { printf("%c", s[i]); } } printf("\n"); } return 0; } | cs |
반응형