Last active
August 12, 2021 16:02
-
-
Save magurofly/4b00ea21d9667722a419a43691c72323 to your computer and use it in GitHub Desktop.
愚直解 https%3A//twitter.com/realDivineJK/status/1425847790345748492
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N, K, M = gets.split.map(&:to_i) | |
sum = 0 | |
(1 .. N).each do |i| | |
sum += i.pow(K, M) | |
sum %= M | |
end | |
puts sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment