Files
2025-12-26 17:35:14 +08:00

11 lines
763 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Distinct Powers
只需要比较所有可能重复的底和幂找到有多少这样的a^b就能知道有多少重复。
这个逻辑最为简单,我自己的实现免费处理较大额的底和幂的情况,这点我暂时没想到好方法。
当看到 [WP(Page 5)](https://projecteuler.net/post_id=92910) 的方法,我才明白自己的问题在哪。
这类问题真的是,单纯解出来不算什么,如何使用数学更简单更快捷的解出来,才是难的。
核心关键点是组合数学的[容斥原理](https://zh.wikipedia.org/wiki/%E6%8E%92%E5%AE%B9%E5%8E%9F%E7%90%86)。
因为幂的数学特点可能需要多次应用容斥原理以确保不重复计算。这也是我自己方法和WP方法的差距所在。