백준 2675 문자열 반복

Console Programming/C# Console 2019. 10. 8. 03:50

처음에 문제를 잘못이해했다.

2

3 ABC

5 /HTP

에서 2가 테스트케이스의 개수를 지정하는 것인데 이것도 테스트케이스로 이해하고 코드를 작성했다.

 

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
using System;
 
namespace TestMain
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] str = input.Split(' ');
            int replayNum = int.Parse(str[0]);
 
            string substr = str[1];
 
            for (int j = 0; j < substr.Length; j++)
            {
                for (int i = 0; i < replayNum; i++)
                {
                    Console.Write(substr[j]);
                }
            }
        }
    }
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

 

: