回答編集履歴
1
追記
test
CHANGED
@@ -33,3 +33,51 @@
|
|
33
33
|
}
|
34
34
|
|
35
35
|
```
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
### 追記 System.Reactive を使う
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
```C#
|
44
|
+
|
45
|
+
using System;
|
46
|
+
|
47
|
+
using System.Numerics;
|
48
|
+
|
49
|
+
using System.Reactive;
|
50
|
+
|
51
|
+
using System.Reactive.Linq;
|
52
|
+
|
53
|
+
using System.Threading.Tasks;
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
namespace ConsoleApp1
|
58
|
+
|
59
|
+
{
|
60
|
+
|
61
|
+
class Program
|
62
|
+
|
63
|
+
{
|
64
|
+
|
65
|
+
static async Task Main() => await Observable
|
66
|
+
|
67
|
+
.Repeat(Unit.Default)
|
68
|
+
|
69
|
+
.Select(_ => Console.ReadLine())
|
70
|
+
|
71
|
+
.TakeWhile(a => !string.IsNullOrEmpty(a))
|
72
|
+
|
73
|
+
.Select(a => BigInteger.Parse(a))
|
74
|
+
|
75
|
+
.Retry()
|
76
|
+
|
77
|
+
.ForEachAsync(a => Console.WriteLine((a + 1) * a / 2));
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
```
|