回答編集履歴
1
見直しキャンペーン中
answer
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
書式指定に「数値をゼロや空白で指定桁埋める」はありますが、「任意の文字を指定個作る」のようなものはないんじゃないでしょうか(自作すれば別ですが)
|
1
|
+
書式指定に「数値をゼロや空白で指定桁埋める」はありますが、「任意の文字を指定個作る」のようなものはないんじゃないでしょうか(自作すれば別ですが)
|
2
|
-
|
2
|
+
|
3
|
-
`new string('■', y)`で作るのが手っ取り早そうです。
|
3
|
+
`new string('■', y)`で作るのが手っ取り早そうです。
|
4
|
-
|
4
|
+
|
5
|
-
```
|
5
|
+
```cs
|
6
|
-
using System.IO;
|
6
|
+
using System.IO;
|
7
|
-
|
7
|
+
|
8
|
-
namespace Questions240753
|
8
|
+
namespace Questions240753
|
9
|
-
{
|
9
|
+
{
|
10
|
-
class Program
|
10
|
+
class Program
|
11
|
-
{
|
11
|
+
{
|
12
|
-
static void Main()
|
12
|
+
static void Main()
|
13
|
-
{
|
13
|
+
{
|
14
|
-
const int N = 10;
|
14
|
+
const int N = 10;
|
15
|
-
const int A = 5;
|
15
|
+
const int A = 5;
|
16
|
-
|
16
|
+
|
17
|
-
using(StreamWriter sw = new StreamWriter("test.txt"))
|
17
|
+
using(StreamWriter sw = new StreamWriter("test.txt"))
|
18
|
-
{
|
18
|
+
{
|
19
|
-
for(int i = 0; i < N; ++i)
|
19
|
+
for(int i = 0; i < N; ++i)
|
20
|
-
{
|
20
|
+
{
|
21
|
-
int y = i % A + 1;
|
21
|
+
int y = i % A + 1;
|
22
|
-
int x = A - y;
|
22
|
+
int x = A - y;
|
23
|
-
sw.WriteLine(new string(' ', x) + new string('■', y));
|
23
|
+
sw.WriteLine(new string(' ', x) + new string('■', y));
|
24
|
-
}
|
24
|
+
}
|
25
|
-
}
|
25
|
+
}
|
26
|
-
}
|
26
|
+
}
|
27
|
-
}
|
27
|
+
}
|
28
|
-
}
|
28
|
+
}
|
29
29
|
```
|