Difference between revisions of "2019 Multi-University,Nowcoder Day 4"

From EOJ Wiki
Jump to navigation Jump to search
Line 42: Line 42:
  
 
Solved by Xiejiadong. 00:19:37 (+)
 
Solved by Xiejiadong. 00:19:37 (+)
 +
 +
题意:求字符串的子串中有多少 $300$ 的倍数。
 +
 +
题解:$300$ 的倍数就是末尾有两个 $0$ ,前面的数字和是 $3$ 的倍数就好了。
 +
 +
我们把当前数字后面跟着两个 $0$ 的位置称为有效的结束位置,把所有的有效结束位置的前缀和模 $3$ 扔进 map 。
 +
 +
然后枚举开头,判断有多少同值的有效结尾就好了。
 +
 +
还需要特判一个 $0$ 和两个连续 $0$ 的情况。

Revision as of 11:51, 27 July 2019

Problem A

Solved by Weaver_zhu. 01:43:34 (+)

Problem B

Unsolved. (-5)

Problem C

Solved by Kilo_5723. 03:23:47 (+2)

Problem D

Solved by Xiejiadong. 01:23:59 (+)

Problem E

Solved by Kilo_5723. 04:02:11 (+1)

Problem F

Unsolved.

Problem G

Unsolved.

Problem H

Unsolved.

Problem I

Solved by Xiejiadong. 02:47:24 (+1)

Problem J

Solved by Kilo_5723. 01:39:30 (+3)

Problem K

Solved by Xiejiadong. 00:19:37 (+)

题意:求字符串的子串中有多少 $300$ 的倍数。

题解:$300$ 的倍数就是末尾有两个 $0$ ,前面的数字和是 $3$ 的倍数就好了。

我们把当前数字后面跟着两个 $0$ 的位置称为有效的结束位置,把所有的有效结束位置的前缀和模 $3$ 扔进 map 。

然后枚举开头,判断有多少同值的有效结尾就好了。

还需要特判一个 $0$ 和两个连续 $0$ 的情况。