Skip to content

Commit ddd3faa

Browse files
committed
fix
1 parent 97d5965 commit ddd3faa

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

copypasta/template/atcoder/generator.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,23 @@ func parseTask(session *grequests.Session, problemURL string) (sampleIns, sample
183183
var f func(*html.Node)
184184
f = func(o *html.Node) {
185185
if o.Type == html.TextNode {
186+
get := func() string {
187+
if o.Parent.NextSibling.FirstChild != nil {
188+
return o.Parent.NextSibling.FirstChild.Data
189+
}
190+
// https://atcoder.jp/contests/abc371/tasks/abc371_e
191+
return o.Parent.NextSibling.NextSibling.FirstChild.Data
192+
}
186193
if inputRegex.MatchString(o.Data) {
187-
raw := o.Parent.NextSibling.FirstChild.Data
194+
raw := get()
188195
raw = strings.TrimSpace(raw)
189196
sampleIns = append(sampleIns, raw)
190197
} else if outputRegex.MatchString(o.Data) {
191198
if o.Parent.NextSibling.FirstChild == nil {
192199
// 样例输出为空,例如 https://atcoder.jp/contests/abc150/tasks/abc150_f
193200
sampleOuts = append(sampleOuts, "")
194201
} else {
195-
raw := o.Parent.NextSibling.FirstChild.Data
202+
raw := get()
196203
raw = strings.TrimSpace(raw)
197204
sampleOuts = append(sampleOuts, raw)
198205
}

0 commit comments

Comments
 (0)