意外と苦戦したので備忘録として…
問題
1 行目に整数 N が与えられます。
2 行目から (N + 1) 行目までの先頭に整数 M_i (1 ≦ i ≦ N) が与えられます。それに続いて M_i 個の整数 a_1, ..., a_{M_i} が与えられます。
上から i 番目、左から j 番目の整数は a_{i,j} です。
N 行の a_1, ..., a_M をそのまま出力してください。入力例1
3
1 8
2 8 1
3 8 1 3
出力例1
8
8 1
8 1 3
C#解答案
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main()
{
int num = int.Parse(Console.ReadLine());
//二次元リストの宣言
List<List<string>> list = new List<List<string>>();
//二次元リストに要素追加
for(int i=0; i<num; i++){
string[] inputstr = Console.ReadLine().Split(' ');
List<string> list2 = new List<string>(inputstr);
list.Add(list2);
}
//二次元リストの各行の先頭を除き、スペース連結で出力
List<string> li = new List<string>();
for(int m=0; m<num; m++){
Console.WriteLine(string.Join(" ",list[m].Skip(1)));
}
}
}