Volume 08
351. Hexagonal orchards
很容易推出答案是. 用筛法求出
即可.
352. Blood tests
353. Risky moon
354. Distances in a bee's honeycomb
355. Maximal coprime subset
356. Largest roots of cubic polynomials
357. Prime generating integers
可以算出要是一个square free number, 否则可以找到一个
使得
. 于是枚举所有的square free number, 然后暴力枚举
即可.
358. Cyclic numbers
可以在wiki上搜到一些关于Cyclic number的结论. 知道有, 化简一下有
, 于是
.
然后有, 又知道
必须是
的原根. 于是就可以根据这些条件计算出可行的
. 另外也可以发现最后答案就是
, 当然也可以直接暴力求解.
359. Hilbert's New Hotel
oeis上有这个数列, 根据规律做些优化就好了.
360. Scary Sphere
361. Subsequence of Thue-Morse sequence
362. Squarefree factors
363. Bézier Curves
364. Comfortable distance
365. A huge binomial coefficient
用lucas定理, 然后中国剩余定理合并就好了.
366. Stone Game III
367. Bozo sort
368. A Kempner-like series
369. Badugi
370. Geometric triangles
371. Licence plates
显然可以把数分成3组, ,
和
. 令
表示没看见过
, 并且已经收集到
种不同数字的期望次数,
则是看见过一次
, 并且已经收集到
种不同数字的期望次数. 递推式很好求:
372. Pencils of rays
373. Circumscribed Circles
374. Maximum Integer Partition Product
375. Minimum of subsequences
376. Nontransitive sets of dice
377. Sum of digits, experience 13
378. Triangle Triples
求出, 然后就直接用树状数组优化dp就好了. 可以考虑先离散化
, 这样可以速度更快.
379. Least common multiple count
370. Amazing Mazes!
381. (prime-k) factorial
威尔逊定理的推广:
382. Generating polygons
383. Divisibility comparison between factorials
384. Rudin-Shapiro sequence
385. Ellipses inside triangles
386. Maximum length of an antichain
387. Harshad Numbers
先dfs计算出所有的right truncatable Harshad number
, 然后一个个枚举判断即可.
388. Distinct Lines
389. Platonic Dice
一层层展开, 暴力dp就好了.
390. Triangles with non rational sides and integral area
391. Hopping Game
392. Enmeshed unit circle
393. Migrating ants
394. Eating pie
395. Pythagorean tree
396. Weak Goodstein sequence
首先在wiki上找到Goodstein's theorem. 在很下面有个计算序列长度的算法, 这个算法同样可以套在weak Goodstein sequence
中, 于是算一下就好了. 算法中用到一个Fast-growing hierarchy, 同样参考wiki即可.